diff options
author | attilio <attilio@FreeBSD.org> | 2013-05-28 22:07:23 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-05-28 22:07:23 +0000 |
commit | 4f8aa13b4a8cb4702c8cf4795a91fb5302ae335f (patch) | |
tree | b19cd81a66bb05d7f2f1d9287be5012784762bb5 /sys/vm/swap_pager.c | |
parent | 89cf9f762aa1fd309a824390f2fbf0d49c49f6dd (diff) | |
download | FreeBSD-src-4f8aa13b4a8cb4702c8cf4795a91fb5302ae335f.zip FreeBSD-src-4f8aa13b4a8cb4702c8cf4795a91fb5302ae335f.tar.gz |
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
Diffstat (limited to 'sys/vm/swap_pager.c')
-rw-r--r-- | sys/vm/swap_pager.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f5a0ba7..5041276 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. |