Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_fault.c
Show First 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, | vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, | ||||
int fault_flags, vm_page_t *m_hold) | int fault_flags, vm_page_t *m_hold) | ||||
{ | { | ||||
struct faultstate fs; | struct faultstate fs; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct domainset *dset; | |||||
vm_object_t next_object, retry_object; | vm_object_t next_object, retry_object; | ||||
vm_offset_t e_end, e_start; | vm_offset_t e_end, e_start; | ||||
vm_pindex_t retry_pindex; | vm_pindex_t retry_pindex; | ||||
vm_prot_t prot, retry_prot; | vm_prot_t prot, retry_prot; | ||||
int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; | int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; | ||||
int locked, nera, result, rv; | int locked, nera, result, rv; | ||||
u_char behavior; | u_char behavior; | ||||
boolean_t wired; /* Passed by reference. */ | boolean_t wired; /* Passed by reference. */ | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | if (fs.object->type != OBJT_DEFAULT || | ||||
/* | /* | ||||
* Allocate a new page for this object/offset pair. | * Allocate a new page for this object/offset pair. | ||||
* | * | ||||
* Unlocked read of the p_flag is harmless. At | * Unlocked read of the p_flag is harmless. At | ||||
* worst, the P_KILLED might be not observed | * worst, the P_KILLED might be not observed | ||||
* there, and allocation can fail, causing | * there, and allocation can fail, causing | ||||
* restart and new reading of the p_flag. | * restart and new reading of the p_flag. | ||||
*/ | */ | ||||
if (!vm_page_count_severe() || P_KILLED(curproc)) { | dset = fs.object->domain.dr_policy; | ||||
if (dset == NULL) | |||||
dset = curthread->td_domain.dr_policy; | |||||
if (!vm_page_count_severe_set(&dset->ds_mask) || | |||||
P_KILLED(curproc)) { | |||||
#if VM_NRESERVLEVEL > 0 | #if VM_NRESERVLEVEL > 0 | ||||
vm_object_color(fs.object, atop(vaddr) - | vm_object_color(fs.object, atop(vaddr) - | ||||
fs.pindex); | fs.pindex); | ||||
#endif | #endif | ||||
alloc_req = P_KILLED(curproc) ? | alloc_req = P_KILLED(curproc) ? | ||||
VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL; | VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL; | ||||
if (fs.object->type != OBJT_VNODE && | if (fs.object->type != OBJT_VNODE && | ||||
fs.object->backing_object == NULL) | fs.object->backing_object == NULL) | ||||
alloc_req |= VM_ALLOC_ZERO; | alloc_req |= VM_ALLOC_ZERO; | ||||
fs.m = vm_page_alloc(fs.object, fs.pindex, | fs.m = vm_page_alloc(fs.object, fs.pindex, | ||||
alloc_req); | alloc_req); | ||||
} | } | ||||
if (fs.m == NULL) { | if (fs.m == NULL) { | ||||
unlock_and_deallocate(&fs); | unlock_and_deallocate(&fs); | ||||
vm_waitpfault(); | vm_waitpfault(dset); | ||||
goto RetryFault; | goto RetryFault; | ||||
} | } | ||||
} | } | ||||
readrest: | readrest: | ||||
/* | /* | ||||
* At this point, we have either allocated a new page or found | * At this point, we have either allocated a new page or found | ||||
* an existing page that is only partially valid. | * an existing page that is only partially valid. | ||||
▲ Show 20 Lines • Show All 981 Lines • Show Last 20 Lines |