Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_glue.c
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | #if 0 | ||||
* Also, the sysctl code, which is the only present user | * Also, the sysctl code, which is the only present user | ||||
* of vslock(), does a hard loop on EAGAIN. | * of vslock(), does a hard loop on EAGAIN. | ||||
*/ | */ | ||||
if (npages + vm_wire_count() > vm_page_max_wired) | if (npages + vm_wire_count() > vm_page_max_wired) | ||||
return (EAGAIN); | return (EAGAIN); | ||||
#endif | #endif | ||||
error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, | error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, | ||||
VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); | VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); | ||||
if (error == KERN_SUCCESS) { | |||||
curthread->td_vslock_sz += len; | |||||
return (0); | |||||
} | |||||
/* | /* | ||||
* Return EFAULT on error to match copy{in,out}() behaviour | * Return EFAULT on error to match copy{in,out}() behaviour | ||||
* rather than returning ENOMEM like mlock() would. | * rather than returning ENOMEM like mlock() would. | ||||
*/ | */ | ||||
return (error == KERN_SUCCESS ? 0 : EFAULT); | return (EFAULT); | ||||
} | } | ||||
void | void | ||||
vsunlock(void *addr, size_t len) | vsunlock(void *addr, size_t len) | ||||
{ | { | ||||
/* Rely on the parameter sanity checks performed by vslock(). */ | /* Rely on the parameter sanity checks performed by vslock(). */ | ||||
MPASS(curthread->td_vslock_sz >= len); | |||||
curthread->td_vslock_sz -= len; | |||||
(void)vm_map_unwire(&curproc->p_vmspace->vm_map, | (void)vm_map_unwire(&curproc->p_vmspace->vm_map, | ||||
trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), | trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), | ||||
VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); | VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); | ||||
} | } | ||||
/* | /* | ||||
* Pin the page contained within the given object at the given offset. If the | * Pin the page contained within the given object at the given offset. If the | ||||
* page is not resident, allocate and load it using the given object's pager. | * page is not resident, allocate and load it using the given object's pager. | ||||
▲ Show 20 Lines • Show All 372 Lines • Show Last 20 Lines |