From e028603b7e3e4fb35cdf00aab533f3965f4a13cc Mon Sep 17 00:00:00 2001 From: dillon Date: Wed, 4 Jul 2001 16:20:28 +0000 Subject: 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. --- sys/vm/vm_pager.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'sys/vm/vm_pager.c') 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; } -- cgit v1.1