Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_fault.c
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | |||||
#define VM_FAULT_READ_DEFAULT (1 + VM_FAULT_READ_AHEAD_INIT) | #define VM_FAULT_READ_DEFAULT (1 + VM_FAULT_READ_AHEAD_INIT) | ||||
#define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) | #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) | ||||
#define VM_FAULT_DONTNEED_MIN 1048576 | #define VM_FAULT_DONTNEED_MIN 1048576 | ||||
struct faultstate { | struct faultstate { | ||||
vm_page_t m; | vm_page_t m; | ||||
vm_page_t m_cow; | |||||
vm_object_t object; | vm_object_t object; | ||||
vm_pindex_t pindex; | vm_pindex_t pindex; | ||||
vm_page_t first_m; | vm_page_t first_m; | ||||
vm_object_t first_object; | vm_object_t first_object; | ||||
vm_pindex_t first_pindex; | vm_pindex_t first_pindex; | ||||
vm_map_t map; | vm_map_t map; | ||||
vm_map_entry_t entry; | vm_map_entry_t entry; | ||||
int map_generation; | int map_generation; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if (fs->vp != NULL) { | ||||
fs->vp = NULL; | fs->vp = NULL; | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
fault_deallocate(struct faultstate *fs) | fault_deallocate(struct faultstate *fs) | ||||
{ | { | ||||
fault_page_release(&fs->m_cow); | |||||
fault_page_release(&fs->m); | fault_page_release(&fs->m); | ||||
vm_object_pip_wakeup(fs->object); | vm_object_pip_wakeup(fs->object); | ||||
if (fs->object != fs->first_object) { | if (fs->object != fs->first_object) { | ||||
VM_OBJECT_WLOCK(fs->first_object); | VM_OBJECT_WLOCK(fs->first_object); | ||||
fault_page_free(&fs->first_m); | fault_page_free(&fs->first_m); | ||||
VM_OBJECT_WUNLOCK(fs->first_object); | VM_OBJECT_WUNLOCK(fs->first_object); | ||||
vm_object_pip_wakeup(fs->first_object); | vm_object_pip_wakeup(fs->first_object); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 594 Lines • ▼ Show 20 Lines | RetryFault_oom: | ||||
* Bump the paging-in-progress count to prevent size changes (e.g. | * Bump the paging-in-progress count to prevent size changes (e.g. | ||||
* truncation operations) during I/O. | * truncation operations) during I/O. | ||||
*/ | */ | ||||
vm_object_reference_locked(fs.first_object); | vm_object_reference_locked(fs.first_object); | ||||
vm_object_pip_add(fs.first_object, 1); | vm_object_pip_add(fs.first_object, 1); | ||||
fs.lookup_still_valid = true; | fs.lookup_still_valid = true; | ||||
fs.m = fs.first_m = NULL; | fs.m_cow = fs.m = fs.first_m = NULL; | ||||
/* | /* | ||||
* Search for the page at object/offset. | * Search for the page at object/offset. | ||||
*/ | */ | ||||
fs.object = fs.first_object; | fs.object = fs.first_object; | ||||
fs.pindex = fs.first_pindex; | fs.pindex = fs.first_pindex; | ||||
while (TRUE) { | while (TRUE) { | ||||
KASSERT(fs.m == NULL, | KASSERT(fs.m == NULL, | ||||
▲ Show 20 Lines • Show All 419 Lines • ▼ Show 20 Lines | #endif | ||||
pmap_copy_page(fs.m, fs.first_m); | pmap_copy_page(fs.m, fs.first_m); | ||||
vm_page_valid(fs.first_m); | vm_page_valid(fs.first_m); | ||||
if (wired && (fault_flags & | if (wired && (fault_flags & | ||||
VM_FAULT_WIRE) == 0) { | VM_FAULT_WIRE) == 0) { | ||||
vm_page_wire(fs.first_m); | vm_page_wire(fs.first_m); | ||||
vm_page_unwire(fs.m, PQ_INACTIVE); | vm_page_unwire(fs.m, PQ_INACTIVE); | ||||
} | } | ||||
/* | /* | ||||
* We no longer need the old page or object. | * Save the cow page to be released after | ||||
* pmap_enter is complete. | |||||
*/ | */ | ||||
fault_page_release(&fs.m); | fs.m_cow = fs.m; | ||||
fs.m = NULL; | |||||
} | } | ||||
/* | /* | ||||
* fs.object != fs.first_object due to above | * fs.object != fs.first_object due to above | ||||
* conditional | * conditional | ||||
*/ | */ | ||||
vm_object_pip_wakeup(fs.object); | vm_object_pip_wakeup(fs.object); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 632 Lines • Show Last 20 Lines |