Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_fault.c
Show First 20 Lines • Show All 476 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
VM_OBJECT_WUNLOCK(fs->first_object); | VM_OBJECT_WUNLOCK(fs->first_object); | ||||
pmap_enter(fs->map->pmap, vaddr, m, prot, fault_type | (wired ? | pmap_enter(fs->map->pmap, vaddr, m, prot, fault_type | (wired ? | ||||
PMAP_ENTER_WIRED : 0), psind); | PMAP_ENTER_WIRED : 0), psind); | ||||
VM_OBJECT_WLOCK(fs->first_object); | VM_OBJECT_WLOCK(fs->first_object); | ||||
m_mtx = NULL; | m_mtx = NULL; | ||||
for (i = 0; i < npages; i++) { | for (i = 0; i < npages; i++) { | ||||
vm_page_change_lock(&m[i], &m_mtx); | vm_page_change_lock(&m[i], &m_mtx); | ||||
if ((fault_flags & VM_FAULT_WIRE) != 0) { | if ((fault_flags & VM_FAULT_WIRE) != 0) | ||||
KASSERT(wired, ("VM_FAULT_WIRE && !wired")); | |||||
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_hold(&m[i]); | vm_page_hold(&m[i]); | ||||
} | } | ||||
vm_page_xunbusy(&m[i]); | vm_page_xunbusy(&m[i]); | ||||
} | } | ||||
if (m_mtx != NULL) | if (m_mtx != NULL) | ||||
▲ Show 20 Lines • Show All 745 Lines • ▼ Show 20 Lines | if (fs.map->timestamp != fs.map_generation) { | ||||
*/ | */ | ||||
prot &= retry_prot; | prot &= retry_prot; | ||||
fault_type &= retry_prot; | fault_type &= retry_prot; | ||||
if (prot == 0) { | if (prot == 0) { | ||||
release_page(&fs); | release_page(&fs); | ||||
unlock_and_deallocate(&fs); | unlock_and_deallocate(&fs); | ||||
goto RetryFault; | goto RetryFault; | ||||
} | } | ||||
/* Reassert because wired may have changed. */ | |||||
KASSERT(wired || (fault_flags & VM_FAULT_WIRE) == 0, | |||||
("!wired && VM_FAULT_WIRE")); | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* If the page was filled by a pager, save the virtual address that | * If the page was filled by a pager, save the virtual address that | ||||
* should be faulted on next under a sequential access pattern to the | * should be faulted on next under a sequential access pattern to the | ||||
* map entry. A read lock on the map suffices to update this address | * map entry. A read lock on the map suffices to update this address | ||||
* safely. | * safely. | ||||
Show All 27 Lines | vm_fault_prefault(&fs, vaddr, | ||||
faultcount > 0 ? ahead : PFFOR, false); | faultcount > 0 ? ahead : PFFOR, false); | ||||
VM_OBJECT_WLOCK(fs.object); | VM_OBJECT_WLOCK(fs.object); | ||||
vm_page_lock(fs.m); | vm_page_lock(fs.m); | ||||
/* | /* | ||||
* If the page is not wired down, then put it where the pageout daemon | * If the page is not wired down, then put it where the pageout daemon | ||||
* can find it. | * can find it. | ||||
*/ | */ | ||||
if ((fault_flags & VM_FAULT_WIRE) != 0) { | if ((fault_flags & VM_FAULT_WIRE) != 0) | ||||
KASSERT(wired, ("VM_FAULT_WIRE && !wired")); | |||||
vm_page_wire(fs.m); | vm_page_wire(fs.m); | ||||
} else | else | ||||
vm_page_activate(fs.m); | vm_page_activate(fs.m); | ||||
if (m_hold != NULL) { | if (m_hold != NULL) { | ||||
*m_hold = fs.m; | *m_hold = fs.m; | ||||
vm_page_hold(fs.m); | vm_page_hold(fs.m); | ||||
} | } | ||||
vm_page_unlock(fs.m); | vm_page_unlock(fs.m); | ||||
vm_page_xunbusy(fs.m); | vm_page_xunbusy(fs.m); | ||||
▲ Show 20 Lines • Show All 493 Lines • Show Last 20 Lines |