svn commit: r330871 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Tue Mar 13 18:27:25 UTC 2018


Author: kib
Date: Tue Mar 13 18:27:23 2018
New Revision: 330871
URL: https://svnweb.freebsd.org/changeset/base/330871

Log:
  Revert the chunk from r330410 in vm_page_reclaim_run().
  
  There, the pages freed might be managed but the page's lock is not
  owned.  For KPI correctness, the page lock is requried around the call
  to vm_page_free_prep(), which is asserted.  Reclaim loop already did
  the work which could be done by vm_page_free_prep(), so the lock is
  not needed and the only consequence of not owning it is the assert
  trigger.
  
  Instead of adding the locking to satisfy the assert, revert to the
  code that calls vm_page_free_phys() directly.
  
  Reported by:	pho
  Discussed with:	jeff
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Tue Mar 13 18:24:21 2018	(r330870)
+++ head/sys/vm/vm_page.c	Tue Mar 13 18:27:23 2018	(r330871)
@@ -2538,7 +2538,17 @@ unlock:
 	}
 	if (m_mtx != NULL)
 		mtx_unlock(m_mtx);
-	vm_page_free_pages_toq(&free, false);
+	if ((m = SLIST_FIRST(&free)) != NULL) {
+		vmd = VM_DOMAIN(domain);
+		vm_domain_free_lock(vmd);
+		do {
+			MPASS(vm_phys_domain(m) == domain);
+			SLIST_REMOVE_HEAD(&free, plinks.s.ss);
+			vm_page_free_phys(vmd, m);
+		} while ((m = SLIST_FIRST(&free)) != NULL);
+		vm_domain_free_wakeup(vmd);
+		vm_domain_free_unlock(vmd);
+	}
 	return (error);
 }
 


More information about the svn-src-all mailing list