summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_pager.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/vm/vm_pager.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/vm/vm_pager.c')
-rw-r--r--sys/vm/vm_pager.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c
index e53a14c..07d0655 100644
--- a/sys/vm/vm_pager.c
+++ b/sys/vm/vm_pager.c
@@ -245,18 +245,14 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
{
vm_object_t ret;
struct pagerops *ops;
- int hadvmlock;
- hadvmlock = mtx_owned(&vm_mtx);
- if (!hadvmlock)
- mtx_lock(&vm_mtx);
+ GIANT_REQUIRED;
+
ops = pagertab[type];
if (ops)
ret = (*ops->pgo_alloc) (handle, size, prot, off);
else
ret = NULL;
- if (!hadvmlock)
- mtx_unlock(&vm_mtx);
return (ret);
}
@@ -264,8 +260,7 @@ void
vm_pager_deallocate(object)
vm_object_t object;
{
-
- mtx_assert(&vm_mtx, MA_OWNED);
+ GIANT_REQUIRED;
(*pagertab[object->type]->pgo_dealloc) (object);
}
@@ -385,8 +380,6 @@ initpbuf(struct buf *bp)
*
* NOTE: pfreecnt can be NULL, but this 'feature' will be removed
* relatively soon when the rest of the subsystems get smart about it. XXX
- *
- * vm_mtx can be held or unheld
*/
struct buf *
getpbuf(pfreecnt)
@@ -394,12 +387,9 @@ getpbuf(pfreecnt)
{
int s;
struct buf *bp;
- int hadvmlock;
s = splvm();
- hadvmlock = mtx_owned(&vm_mtx);
- if (hadvmlock)
- mtx_unlock(&vm_mtx);
+ GIANT_REQUIRED;
mtx_lock(&pbuf_mtx);
for (;;) {
@@ -424,8 +414,6 @@ getpbuf(pfreecnt)
splx(s);
initpbuf(bp);
- if (hadvmlock)
- mtx_lock(&vm_mtx);
return bp;
}
OpenPOWER on IntegriCloud