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.
This commit is contained in:
Alan Cox 2010-06-30 17:20:33 +00:00
parent 17d2646b7c
commit 95976f3f38

View File

@ -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 @@ vm_pageout_scan(int pass)
goto unlock_and_continue;
}
}
vm_page_unlock(m);
/*
* If a page is dirty, then it is either being washed