Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_fault.c
Show First 20 Lines • Show All 998 Lines • ▼ Show 20 Lines | if (fs.object->type != OBJT_DEFAULT) { | ||||
/* | /* | ||||
* If an I/O error occurred or the requested page was | * If an I/O error occurred or the requested page was | ||||
* outside the range of the pager, clean up and return | * outside the range of the pager, clean up and return | ||||
* an error. | * an error. | ||||
*/ | */ | ||||
if (rv == VM_PAGER_ERROR || rv == VM_PAGER_BAD) { | if (rv == VM_PAGER_ERROR || rv == VM_PAGER_BAD) { | ||||
vm_page_lock(fs.m); | vm_page_lock(fs.m); | ||||
if (fs.m->wire_count == 0) | if (!vm_page_wired(fs.m)) | ||||
vm_page_free(fs.m); | vm_page_free(fs.m); | ||||
else | else | ||||
vm_page_xunbusy_maybelocked(fs.m); | vm_page_xunbusy_maybelocked(fs.m); | ||||
vm_page_unlock(fs.m); | vm_page_unlock(fs.m); | ||||
fs.m = NULL; | fs.m = NULL; | ||||
unlock_and_deallocate(&fs); | unlock_and_deallocate(&fs); | ||||
return (rv == VM_PAGER_ERROR ? KERN_FAILURE : | return (rv == VM_PAGER_ERROR ? KERN_FAILURE : | ||||
KERN_PROTECTION_FAILURE); | KERN_PROTECTION_FAILURE); | ||||
} | } | ||||
/* | /* | ||||
* The requested page does not exist at this object/ | * The requested page does not exist at this object/ | ||||
* offset. Remove the invalid page from the object, | * offset. Remove the invalid page from the object, | ||||
* waking up anyone waiting for it, and continue on to | * waking up anyone waiting for it, and continue on to | ||||
* the next object. However, if this is the top-level | * the next object. However, if this is the top-level | ||||
* object, we must leave the busy page in place to | * object, we must leave the busy page in place to | ||||
* prevent another process from rushing past us, and | * prevent another process from rushing past us, and | ||||
* inserting the page in that object at the same time | * inserting the page in that object at the same time | ||||
* that we are. | * that we are. | ||||
*/ | */ | ||||
if (fs.object != fs.first_object) { | if (fs.object != fs.first_object) { | ||||
vm_page_lock(fs.m); | vm_page_lock(fs.m); | ||||
if (fs.m->wire_count == 0) | if (!vm_page_wired(fs.m)) | ||||
vm_page_free(fs.m); | vm_page_free(fs.m); | ||||
else | else | ||||
vm_page_xunbusy_maybelocked(fs.m); | vm_page_xunbusy_maybelocked(fs.m); | ||||
vm_page_unlock(fs.m); | vm_page_unlock(fs.m); | ||||
fs.m = NULL; | fs.m = NULL; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 761 Lines • ▼ Show 20 Lines | if (upgrade) { | ||||
if (src_m != dst_m) { | if (src_m != dst_m) { | ||||
vm_page_lock(src_m); | vm_page_lock(src_m); | ||||
vm_page_unwire(src_m, PQ_INACTIVE); | vm_page_unwire(src_m, PQ_INACTIVE); | ||||
vm_page_unlock(src_m); | vm_page_unlock(src_m); | ||||
vm_page_lock(dst_m); | vm_page_lock(dst_m); | ||||
vm_page_wire(dst_m); | vm_page_wire(dst_m); | ||||
vm_page_unlock(dst_m); | vm_page_unlock(dst_m); | ||||
} else { | } else { | ||||
KASSERT(dst_m->wire_count > 0, | KASSERT(vm_page_wired(dst_m), | ||||
("dst_m %p is not wired", dst_m)); | ("dst_m %p is not wired", dst_m)); | ||||
} | } | ||||
} else { | } else { | ||||
vm_page_lock(dst_m); | vm_page_lock(dst_m); | ||||
vm_page_activate(dst_m); | vm_page_activate(dst_m); | ||||
vm_page_unlock(dst_m); | vm_page_unlock(dst_m); | ||||
} | } | ||||
vm_page_xunbusy(dst_m); | vm_page_xunbusy(dst_m); | ||||
Show All 27 Lines |