summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-01-03 20:02:17 +0000
committeralc <alc@FreeBSD.org>2004-01-03 20:02:17 +0000
commit1379475c1edb3d200b9e55dad23db325de541fd3 (patch)
treea403700e20802923fca49c065d1cec682c1646c2 /sys
parent145e93c7c9cdbaa3b9df0515e0d830651e980a43 (diff)
downloadFreeBSD-src-1379475c1edb3d200b9e55dad23db325de541fd3.zip
FreeBSD-src-1379475c1edb3d200b9e55dad23db325de541fd3.tar.gz
Reduce the scope of Giant in swap_pager_alloc().
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/swap_pager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 7264918..c3ba2ee 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -473,8 +473,8 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
{
vm_object_t object;
- mtx_lock(&Giant);
if (handle) {
+ mtx_lock(&Giant);
/*
* Reference existing named region or allocate new one. There
* should not be a race here against swp_pager_meta_build()
@@ -496,6 +496,7 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
VM_OBJECT_UNLOCK(object);
}
sx_xunlock(&sw_alloc_sx);
+ mtx_unlock(&Giant);
} else {
object = vm_object_allocate(OBJT_DEFAULT,
OFF_TO_IDX(offset + PAGE_MASK + size));
@@ -504,7 +505,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
swp_pager_meta_build(object, 0, SWAPBLK_NONE);
VM_OBJECT_UNLOCK(object);
}
- mtx_unlock(&Giant);
return (object);
}
OpenPOWER on IntegriCloud