Lines Matching defs:anon
70 * case [1]: upper layer fault [anon active]
71 * 1A: [read] or [write with anon->an_ref == 1]
72 * I/O takes place in upper level anon and uobj is not touched.
73 * 1B: [write with anon->an_ref > 1]
74 * new anon is alloc'd and data is copied off ["COW"]
80 * data is "promoted" from uobj to a new anon.
98 * - at the same time check pmap for unmapped areas and anon for pages
103 * - ensure source anon is resident in RAM
104 * - if case 1B alloc new anon and copy from source
109 * - if case 2B alloc new anon and copy from source (could be zero
266 * uvmfault_anonget: get data in an anon into a non-busy, non-released
267 * page in that anon.
269 * => Map, amap and thus anon should be locked by caller.
278 struct vm_anon *anon)
283 KASSERT(rw_lock_held(anon->an_lock));
284 KASSERT(anon->an_lock == amap->am_lock);
288 if (anon->an_page) {
296 * Loop until we get the anon data, or fail.
304 pg = anon->an_page;
311 KASSERT(pg->uanon == anon);
332 /* Owner of page is anon. */
334 rwsleep_nsec(pg, anon->an_lock, PVM | PNORELOCK,
341 pg = uvm_pagealloc(NULL, 0, anon, 0);
360 error = uvm_swap_get(pg, anon->an_swslot,
371 * Re-lock the map and anon.
375 rw_enter(anon->an_lock, RW_WRITE);
383 * 1) Page was released during I/O: free anon and ReFault.
386 * case (i.e. drop anon lock if not locked).
394 * if we were RELEASED during I/O, then our anon is
396 * anon and try again.
399 KASSERT(anon->an_ref == 0);
405 uvm_anon_release(anon); /* frees page for us */
413 /* remove page from anon */
414 anon->an_page = NULL;
417 * Remove the swap slot from the anon and
418 * mark the anon as having no real slot.
422 uvm_swap_markbad(anon->an_swslot, 1);
423 anon->an_swslot = SWSLOT_BAD;
437 rw_exit(anon->an_lock);
458 rw_exit(anon->an_lock);
465 * the anon on us.
468 ufi->orig_rvaddr - ufi->entry->start) != anon) {
604 /* True if there is an anon at the faulting address */
607 /* case 1: fault on an anon in our amap */
826 * 2. check if anon exists. if not, page is lower.
827 * 3. if anon exists, enter h/w mapping for neighbors.
837 struct vm_anon *anon;
866 * unmapped or center page. check if any anon at this level.
881 anon = anons[lcv];
882 KASSERT(anon->an_lock == amap->am_lock);
883 if (anon->an_page &&
884 (anon->an_page->pg_flags & (PG_RELEASED|PG_BUSY)) == 0) {
886 uvm_pageactivate(anon->an_page); /* reactivate */
896 VM_PAGE_TO_PHYS(anon->an_page) | flt->pa_flags,
897 (anon->an_ref > 1) ?
912 * 1. acquire anon lock.
913 * 2. get anon. let uvmfault_anonget do the dirty work.
914 * 3. if COW, promote data to new anon
922 struct vm_anon *oanon, *anon = anons[flt->centeridx];
926 /* locked: maps(read), amap, anon */
928 KASSERT(anon->an_lock == amap->am_lock);
932 * have the anon's memory resident. ensure that now.
938 * also, if it is OK, then the anon's page is on the queues.
942 error = uvmfault_anonget(ufi, amap, anon);
966 KASSERT(anon->an_lock == amap->am_lock);
970 * anon to transfer the data into. note that we have a lock
971 * on anon, so no one can busy or release the page until we are done.
978 * if we are out of anon VM we wait for RAM to become available.
981 if ((flt->access_type & PROT_WRITE) != 0 && anon->an_ref > 1) {
983 oanon = anon; /* oanon = old */
984 anon = uvm_analloc();
985 if (anon) {
986 anon->an_lock = amap->am_lock;
987 pg = uvm_pagealloc(NULL, 0, anon, 0);
991 if (anon == NULL || pg == NULL) {
993 if (anon == NULL)
996 anon->an_lock = NULL;
997 anon->an_ref--;
998 uvm_anfree(anon);
1006 if (anon == NULL)
1013 /* got all resources, replace anon with nanon */
1019 ufi->orig_rvaddr - ufi->entry->start, anon, 1);
1041 * note: anon is _not_ locked, but we have the sole references
1047 oanon = anon;
1048 pg = anon->an_page;
1049 if (anon->an_ref > 1) /* disallow writes to ref > 1 anons */
1086 * since an anon with no swap cannot be PG_CLEAN,
1090 uvm_anon_dropswap(anon);
1213 struct vm_anon *anon = NULL;
1251 * the data up to an anon during the fault.
1255 promote = TRUE; /* always need anon here */
1382 * if we are going to promote the data to an anon we
1383 * allocate a blank anon here and plug it into our amap.
1387 panic("uvm_fault: want to promote data, but no anon");
1390 anon = uvm_analloc();
1391 if (anon) {
1398 anon->an_lock = amap->am_lock;
1399 pg = uvm_pagealloc(NULL, 0, anon,
1406 if (anon == NULL || pg == NULL) {
1424 if (anon == NULL)
1427 anon->an_lock = NULL;
1428 anon->an_ref--;
1429 uvm_anfree(anon);
1437 if (anon == NULL)
1493 ufi->orig_rvaddr - ufi->entry->start, anon, 0)) {
1495 uvm_anfree(anon);
1507 /* note: pg is either the uobjpage or the new page in the new anon */
1513 KASSERT(anon == NULL);
1516 KASSERT(anon == NULL || anon->an_lock == amap->am_lock);
1712 * but merely paging in anon data.
1828 * but merely paging in anon data.