From 1379475c1edb3d200b9e55dad23db325de541fd3 Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 3 Jan 2004 20:02:17 +0000 Subject: Reduce the scope of Giant in swap_pager_alloc(). --- sys/vm/swap_pager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys') 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); } -- cgit v1.1