svn commit: r356109 - head/sys/vm

Jeff Roberson jeff at FreeBSD.org
Fri Dec 27 01:50:17 UTC 2019


Author: jeff
Date: Fri Dec 27 01:50:16 2019
New Revision: 356109
URL: https://svnweb.freebsd.org/changeset/base/356109

Log:
  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

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Fri Dec 27 01:36:53 2019	(r356108)
+++ head/sys/vm/vm_page.c	Fri Dec 27 01:50:16 2019	(r356109)
@@ -1751,7 +1751,6 @@ vm_page_replace_hold(vm_page_t mnew, vm_object_t objec
 	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
     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;


More information about the svn-src-all mailing list