diff options
author | trasz <trasz@FreeBSD.org> | 2011-07-06 20:06:44 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2011-07-06 20:06:44 +0000 |
commit | 4a17b24427e55ec7e1862b08a0a9247f0717d010 (patch) | |
tree | 443d8da9aef22fdf042ab6f2cf16f5e2d4f04bd3 /sys/vm/vm_glue.c | |
parent | 1adac93bc0e2f40ac5d98734f9451cb1a0f42124 (diff) | |
download | FreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.zip FreeBSD-src-4a17b24427e55ec7e1862b08a0a9247f0717d010.tar.gz |
All the racct_*() calls need to happen with the proc locked. Fixing this
won't happen before 9.0. This commit adds "#ifdef RACCT" around all the
"PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order
to avoid useless locking/unlocking in kernels built without "options RACCT".
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r-- | sys/vm/vm_glue.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index da9b1dc..c552cb7 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -222,12 +222,14 @@ vslock(void *addr, size_t len) #endif error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); +#ifdef RACCT if (error != KERN_SUCCESS) { PROC_LOCK(curproc); racct_set(curproc, RACCT_MEMLOCK, ptoa(pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map)))); PROC_UNLOCK(curproc); } +#endif /* * Return EFAULT on error to match copy{in,out}() behaviour * rather than returning ENOMEM like mlock() would. @@ -244,10 +246,12 @@ vsunlock(void *addr, size_t len) trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); +#ifdef RACCT PROC_LOCK(curproc); racct_set(curproc, RACCT_MEMLOCK, ptoa(pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map)))); PROC_UNLOCK(curproc); +#endif } /* |