Lines Matching defs:anon
30 * uvm_anon.c: uvm anon ops
54 * uvm_analloc: allocate a new anon.
56 * => anon will have no lock associated.
61 struct vm_anon *anon;
63 anon = pool_get(&uvm_anon_pool, PR_NOWAIT);
64 if (anon) {
65 anon->an_lock = NULL;
66 anon->an_ref = 1;
67 anon->an_page = NULL;
68 anon->an_swslot = 0;
70 return anon;
74 * uvm_anfree_list: free a single anon structure
76 * => anon must be removed from the amap (if anon was in an amap).
77 * => amap must be locked, if anon was owned by amap.
81 uvm_anfree_list(struct vm_anon *anon, struct pglist *pgl)
83 struct vm_page *pg = anon->an_page;
85 KASSERT(anon->an_lock == NULL || rw_write_held(anon->an_lock));
86 KASSERT(anon->an_ref == 0);
92 KASSERT(anon->an_lock != NULL);
100 rw_obj_hold(anon->an_lock);
119 if (anon->an_swslot != 0 && anon->an_swslot != SWSLOT_BAD) {
125 anon->an_lock = NULL;
130 uvm_anon_dropswap(anon);
132 KASSERT(anon->an_page == NULL);
133 KASSERT(anon->an_swslot == 0);
135 pool_put(&uvm_anon_pool, anon);
139 * uvm_anwait: wait for memory to become available to allocate an anon.
144 struct vm_anon *anon;
147 anon = pool_get(&uvm_anon_pool, PR_WAITOK);
148 pool_put(&uvm_anon_pool, anon);
152 * uvm_anon_pagein: fetch an anon's page.
154 * => anon must be locked, and is unlocked upon return.
159 uvm_anon_pagein(struct vm_amap *amap, struct vm_anon *anon)
164 KASSERT(rw_write_held(anon->an_lock));
165 KASSERT(anon->an_lock == amap->am_lock);
168 * Get the page of the anon.
170 rv = uvmfault_anonget(NULL, amap, anon);
174 KASSERT(rw_write_held(anon->an_lock));
182 * VM_PAGER_REFAULT means that the anon was freed.
198 pg = anon->an_page;
199 if (anon->an_swslot > 0) {
200 uvm_swap_free(anon->an_swslot, 1);
202 anon->an_swslot = 0;
213 rw_exit(anon->an_lock);
219 * uvm_anon_dropswap: release any swap resources from this anon.
221 * => anon must be locked or have a reference count of 0.
224 uvm_anon_dropswap(struct vm_anon *anon)
226 KASSERT(anon->an_ref == 0 || rw_lock_held(anon->an_lock));
228 if (anon->an_swslot == 0)
231 uvm_swap_free(anon->an_swslot, 1);
232 anon->an_swslot = 0;
237 * uvm_anon_release: release an anon and its page.
239 * => anon should not have any references.
240 * => anon must be locked.
244 uvm_anon_release(struct vm_anon *anon)
246 struct vm_page *pg = anon->an_page;
249 KASSERT(rw_write_held(anon->an_lock));
254 KASSERT(pg->uanon == anon);
255 KASSERT(anon->an_ref == 0);
261 KASSERT(anon->an_page == NULL);
262 lock = anon->an_lock;
263 uvm_anon_dropswap(anon);
264 pool_put(&uvm_anon_pool, anon);