aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_unix.c
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2001-05-19 01:28:09 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2001-05-19 01:28:09 +0000
commit2395531439bb140427dff4dfd6d67856f907c15e (patch)
tree7d51c8cab74aeec829658414e052238902ea14a0 /sys/vm/vm_unix.c
parent3620eb66f3ef16ff28810c74476f01e29c1562bf (diff)
downloadsrc-2395531439bb140427dff4dfd6d67856f907c15e.tar.gz
src-2395531439bb140427dff4dfd6d67856f907c15e.zip
Introduce a global lock for the vm subsystem (vm_mtx).
vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
Notes
Notes: svn path=/head/; revision=76827
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r--sys/vm/vm_unix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index f9b24f84523d..48613062ee08 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -49,6 +49,9 @@
#include <sys/sysproto.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/systm.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -93,6 +96,7 @@ obreak(p, uap)
return EINVAL;
}
+ mtx_lock(&vm_mtx);
if (new > old) {
vm_size_t diff;
@@ -100,16 +104,19 @@ obreak(p, uap)
rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE,
VM_PROT_ALL, VM_PROT_ALL, 0);
if (rv != KERN_SUCCESS) {
+ mtx_unlock(&vm_mtx);
return (ENOMEM);
}
vm->vm_dsize += btoc(diff);
} else if (new < old) {
rv = vm_map_remove(&vm->vm_map, new, old);
if (rv != KERN_SUCCESS) {
+ mtx_unlock(&vm_mtx);
return (ENOMEM);
}
vm->vm_dsize -= btoc(old - new);
}
+ mtx_unlock(&vm_mtx);
return (0);
}