From c25673ffd6fb7718dcf8430c432a82dff72e42e3 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Tue, 28 May 2013 22:07:23 +0000 Subject: [PATCH] o Change the locking scheme for swp_bcount. It can now be accessed with a write lock on the object containing it OR with a read lock on the object containing it along with the swhash_mtx. o Remove some duplicate assertions for swap_pager_freespace() and swap_pager_unswapped() but keep the object locking references for documentation. Sponsored by: EMC / Isilon storage division Reviewed by: alc --- sys/vm/swap_pager.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f5a0ba7fb407..50412762c016 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -822,12 +822,13 @@ swp_pager_freeswapspace(daddr_t blk, int npages) * The external callers of this routine typically have already destroyed * or renamed vm_page_t's associated with this range in the object so * we should be ok. + * + * The object must be locked. */ void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size) { - VM_OBJECT_ASSERT_WLOCKED(object); swp_pager_meta_free(object, start, size); } @@ -999,7 +1000,7 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *aft { daddr_t blk0; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); /* * do we have good backing store at the requested index ? */ @@ -1065,12 +1066,13 @@ swap_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, int *aft * depends on it. * * This routine may not sleep. + * + * The object containing the page must be locked. */ static void swap_pager_unswapped(vm_page_t m) { - VM_OBJECT_ASSERT_WLOCKED(m->object); swp_pager_meta_ctl(m->object, m->pindex, SWM_FREE); } @@ -1916,7 +1918,7 @@ static void swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count) { - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); if (object->type != OBJT_SWAP) return; @@ -2021,7 +2023,7 @@ swp_pager_meta_ctl(vm_object_t object, vm_pindex_t pindex, int flags) daddr_t r1; int idx; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); /* * The meta data only exists of the object is OBJT_SWAP * and even then might not be allocated yet.