summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs/procfs_mem.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
committerdillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
commite028603b7e3e4fb35cdf00aab533f3965f4a13cc (patch)
tree7420cce169451a74c5b87963467a4aeff668ed12 /sys/fs/procfs/procfs_mem.c
parent0b028660051eb7abf4306d34e7fec0e7fde86a28 (diff)
downloadFreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.zip
FreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.tar.gz
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
Diffstat (limited to 'sys/fs/procfs/procfs_mem.c')
-rw-r--r--sys/fs/procfs/procfs_mem.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/fs/procfs/procfs_mem.c b/sys/fs/procfs/procfs_mem.c
index b8c60d6..e109146 100644
--- a/sys/fs/procfs/procfs_mem.c
+++ b/sys/fs/procfs/procfs_mem.c
@@ -83,6 +83,8 @@ procfs_rwmem(curp, p, uio)
vm_prot_t reqprot;
vm_offset_t kva;
+ GIANT_REQUIRED;
+
/*
* if the vmspace is in the midst of being deallocated or the
* process is exiting, don't try to grab anything. The page table
@@ -91,12 +93,8 @@ procfs_rwmem(curp, p, uio)
vm = p->p_vmspace;
if ((p->p_flag & P_WEXIT))
return EFAULT;
-
- mtx_lock(&vm_mtx);
- if (vm->vm_refcnt < 1) {
- mtx_unlock(&vm_mtx);
+ if (vm->vm_refcnt < 1)
return EFAULT;
- }
++vm->vm_refcnt;
/*
* The map we want...
@@ -214,9 +212,7 @@ procfs_rwmem(curp, p, uio)
/*
* Now do the i/o move.
*/
- mtx_unlock(&vm_mtx);
error = uiomove((caddr_t)(kva + page_offset), len, uio);
- mtx_lock(&vm_mtx);
pmap_kremove(kva);
@@ -235,7 +231,6 @@ procfs_rwmem(curp, p, uio)
kmem_free(kernel_map, kva, PAGE_SIZE);
vmspace_free(vm);
- mtx_unlock(&vm_mtx);
return (error);
}
OpenPOWER on IntegriCloud