summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2010-06-30 17:20:33 +0000
committeralc <alc@FreeBSD.org>2010-06-30 17:20:33 +0000
commita694f0930c7023ba970be2b183e50008c28bdfe9 (patch)
treee5042f03dfee9b41774c4d0eba334977c4724214 /sys/vm
parentaf5d2bea56966eff4f6c49410d9e565124e0a6ae (diff)
downloadFreeBSD-src-a694f0930c7023ba970be2b183e50008c28bdfe9.zip
FreeBSD-src-a694f0930c7023ba970be2b183e50008c28bdfe9.tar.gz
Simplify entry to vm_pageout_clean(). Expect the page to be locked.
Previously, the caller unlocked the page, and vm_pageout_clean() immediately reacquired the page lock. Also, assert rather than test that the page is neither busy nor held. Since vm_pageout_clean() is called with the object and page locked, the page can't have changed state since the caller verified that the page is neither busy nor held.
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_pageout.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index cdfddf6..8a31573 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -325,8 +325,7 @@ vm_pageout_clean(vm_page_t m)
int ib, is, page_base;
vm_pindex_t pindex = m->pindex;
- vm_page_lock_assert(m, MA_NOTOWNED);
- vm_page_lock(m);
+ vm_page_lock_assert(m, MA_OWNED);
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
/*
@@ -341,11 +340,9 @@ vm_pageout_clean(vm_page_t m)
/*
* Can't clean the page if it's busy or held.
*/
- if ((m->hold_count != 0) ||
- ((m->busy != 0) || (m->oflags & VPO_BUSY))) {
- vm_page_unlock(m);
- return 0;
- }
+ KASSERT(m->busy == 0 && (m->oflags & VPO_BUSY) == 0,
+ ("vm_pageout_clean: page %p is busy", m));
+ KASSERT(m->hold_count == 0, ("vm_pageout_clean: page %p is held", m));
mc[vm_pageout_page_count] = pb = ps = m;
pageout_count = 1;
@@ -1060,7 +1057,6 @@ rescan0:
goto unlock_and_continue;
}
}
- vm_page_unlock(m);
/*
* If a page is dirty, then it is either being washed
OpenPOWER on IntegriCloud