summaryrefslogtreecommitdiff
path: root/sys/vm/vm_unix.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-05-23 22:13:10 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-05-23 22:13:10 +0000
commitbb10bb497843aadbb454110fe2c8d645976ddf33 (patch)
tree02b274e83cd911e629445ee745da7badc1f7f998 /sys/vm/vm_unix.c
parent95f27dc63979c13556c8f363d3214f5276e53b6b (diff)
Notes
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r--sys/vm/vm_unix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index 29ae2ad779cc..f4efc2e7ffd3 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -95,11 +95,11 @@ obreak(p, uap)
return EINVAL;
}
- mtx_lock(&vm_mtx);
if (new > old) {
vm_size_t diff;
diff = new - old;
+ mtx_lock(&vm_mtx);
rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE,
VM_PROT_ALL, VM_PROT_ALL, 0);
if (rv != KERN_SUCCESS) {
@@ -107,15 +107,20 @@ obreak(p, uap)
return (ENOMEM);
}
vm->vm_dsize += btoc(diff);
+ mtx_unlock(&vm_mtx);
} else if (new < old) {
+ mtx_lock(&Giant);
+ mtx_lock(&vm_mtx);
rv = vm_map_remove(&vm->vm_map, new, old);
if (rv != KERN_SUCCESS) {
mtx_unlock(&vm_mtx);
+ mtx_unlock(&Giant);
return (ENOMEM);
}
vm->vm_dsize -= btoc(old - new);
+ mtx_unlock(&vm_mtx);
+ mtx_unlock(&Giant);
}
- mtx_unlock(&vm_mtx);
return (0);
}