Fix a pair of bugs introduced in r356002. When we reclaim physical pages we

allocate them with VM_ALLOC_NOOBJ which means they are not busy.  For now
move the busy assert for the new page in vm_page_replace into the public
api and out of the private api used by contig reclaim.  Fix another issue
where we would leak busy if the page could not be removed from pmap.

Reported by:	pho
Discussed with:	markj
This commit is contained in:
Jeff Roberson 2019-12-27 01:50:16 +00:00
parent a29df733fa
commit ff5ce8a7a5

@ -1751,7 +1751,6 @@ vm_page_replace_hold(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex,
bool dropped;
VM_OBJECT_ASSERT_WLOCKED(object);
vm_page_assert_xbusied(mnew);
vm_page_assert_xbusied(mold);
KASSERT(mnew->object == NULL && (mnew->ref_count & VPRC_OBJREF) == 0,
("vm_page_replace: page %p already in object", mnew));
@ -1795,6 +1794,8 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex,
vm_page_t mold)
{
vm_page_assert_xbusied(mnew);
if (vm_page_replace_hold(mnew, object, pindex, mold))
vm_page_free(mold);
}
@ -2793,6 +2794,7 @@ retry:
*/
if (object->ref_count != 0 &&
!vm_page_try_remove_all(m)) {
vm_page_xunbusy(m);
vm_page_free(m_new);
error = EBUSY;
goto unlock;