Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_fault.c
Show First 20 Lines • Show All 502 Lines • ▼ Show 20 Lines | for (i = 0; i < npages; i++) { | ||||
if ((fault_flags & VM_FAULT_WIRE) != 0) | if ((fault_flags & VM_FAULT_WIRE) != 0) | ||||
vm_page_wire(&m[i]); | vm_page_wire(&m[i]); | ||||
else | else | ||||
vm_page_activate(&m[i]); | vm_page_activate(&m[i]); | ||||
if (m_hold != NULL && m[i].pindex == fs->first_pindex) { | if (m_hold != NULL && m[i].pindex == fs->first_pindex) { | ||||
*m_hold = &m[i]; | *m_hold = &m[i]; | ||||
vm_page_wire(&m[i]); | vm_page_wire(&m[i]); | ||||
} | } | ||||
vm_page_xunbusy_maybelocked(&m[i]); | vm_page_xunbusy(&m[i]); | ||||
} | } | ||||
if (m_mtx != NULL) | if (m_mtx != NULL) | ||||
mtx_unlock(m_mtx); | mtx_unlock(m_mtx); | ||||
} | } | ||||
curthread->td_ru.ru_majflt++; | curthread->td_ru.ru_majflt++; | ||||
return (KERN_SUCCESS); | return (KERN_SUCCESS); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 484 Lines • ▼ Show 20 Lines | if (fs.object->type != OBJT_DEFAULT) { | ||||
* 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 (!vm_page_wired(fs.m)) | 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(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 (!vm_page_wired(fs.m)) | 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(fs.m); | ||||
vm_page_unlock(fs.m); | vm_page_unlock(fs.m); | ||||
fs.m = NULL; | fs.m = NULL; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* We get here if the object has default pager (or unwiring) | * We get here if the object has default pager (or unwiring) | ||||
* or the pager doesn't have the page. | * or the pager doesn't have the page. | ||||
▲ Show 20 Lines • Show All 812 Lines • Show Last 20 Lines |