diff options
author | gjb <gjb@FreeBSD.org> | 2015-05-01 18:07:18 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2015-05-01 18:07:18 +0000 |
commit | 55e5b36d38ff95ded004ed97fe9ed303abb36184 (patch) | |
tree | ca54c9ba1af0ca2eb29e395b069252993a4e1ada /sys/vm/vm_mmap.c | |
parent | dfb432f9b57e5f768243247ed35fbe38bb9c40f1 (diff) | |
parent | fecee76e5a26a3b0a0cac30b34c660389e57579e (diff) | |
download | FreeBSD-src-55e5b36d38ff95ded004ed97fe9ed303abb36184.zip FreeBSD-src-55e5b36d38ff95ded004ed97fe9ed303abb36184.tar.gz |
MFH: r281855-r282312
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r-- | sys/vm/vm_mmap.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 02634d6..1dd2479 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1122,16 +1122,18 @@ vm_mlock(struct proc *proc, struct ucred *cred, const void *addr0, size_t len) if (npages + vm_cnt.v_wire_count > vm_page_max_wired) return (EAGAIN); #ifdef RACCT - PROC_LOCK(proc); - error = racct_set(proc, RACCT_MEMLOCK, nsize); - PROC_UNLOCK(proc); - if (error != 0) - return (ENOMEM); + if (racct_enable) { + PROC_LOCK(proc); + error = racct_set(proc, RACCT_MEMLOCK, nsize); + PROC_UNLOCK(proc); + if (error != 0) + return (ENOMEM); + } #endif error = vm_map_wire(map, start, end, VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); #ifdef RACCT - if (error != KERN_SUCCESS) { + if (racct_enable && error != KERN_SUCCESS) { PROC_LOCK(proc); racct_set(proc, RACCT_MEMLOCK, ptoa(pmap_wired_count(map->pmap))); @@ -1179,11 +1181,13 @@ sys_mlockall(td, uap) PROC_UNLOCK(td->td_proc); } #ifdef RACCT - PROC_LOCK(td->td_proc); - error = racct_set(td->td_proc, RACCT_MEMLOCK, map->size); - PROC_UNLOCK(td->td_proc); - if (error != 0) - return (ENOMEM); + if (racct_enable) { + PROC_LOCK(td->td_proc); + error = racct_set(td->td_proc, RACCT_MEMLOCK, map->size); + PROC_UNLOCK(td->td_proc); + if (error != 0) + return (ENOMEM); + } #endif if (uap->how & MCL_FUTURE) { @@ -1205,7 +1209,7 @@ sys_mlockall(td, uap) error = (error == KERN_SUCCESS ? 0 : EAGAIN); } #ifdef RACCT - if (error != KERN_SUCCESS) { + if (racct_enable && error != KERN_SUCCESS) { PROC_LOCK(td->td_proc); racct_set(td->td_proc, RACCT_MEMLOCK, ptoa(pmap_wired_count(map->pmap))); @@ -1247,7 +1251,7 @@ sys_munlockall(td, uap) error = vm_map_unwire(map, vm_map_min(map), vm_map_max(map), VM_MAP_WIRE_USER|VM_MAP_WIRE_HOLESOK); #ifdef RACCT - if (error == KERN_SUCCESS) { + if (racct_enable && error == KERN_SUCCESS) { PROC_LOCK(td->td_proc); racct_set(td->td_proc, RACCT_MEMLOCK, 0); PROC_UNLOCK(td->td_proc); @@ -1291,7 +1295,7 @@ sys_munlock(td, uap) error = vm_map_unwire(&td->td_proc->p_vmspace->vm_map, start, end, VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); #ifdef RACCT - if (error == KERN_SUCCESS) { + if (racct_enable && error == KERN_SUCCESS) { PROC_LOCK(td->td_proc); map = &td->td_proc->p_vmspace->vm_map; racct_set(td->td_proc, RACCT_MEMLOCK, |