svn commit: r323616 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Fri Sep 15 16:07:10 UTC 2017


Author: kib
Date: Fri Sep 15 16:07:09 2017
New Revision: 323616
URL: https://svnweb.freebsd.org/changeset/base/323616

Log:
  Batch freeing of the pages in vm_object_page_remove() under the same
  free queue mutex lock owning session, same as it was done for the
  object termination in r323561.
  
  Reported and tested by:	mjg
  Reviewed by:	alc, markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Fri Sep 15 15:57:15 2017	(r323615)
+++ head/sys/vm/vm_object.c	Fri Sep 15 16:07:09 2017	(r323616)
@@ -1953,6 +1953,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
 {
 	vm_page_t p, next;
 	struct mtx *mtx;
+	struct pglist pgl;
 
 	VM_OBJECT_ASSERT_WLOCKED(object);
 	KASSERT((object->flags & OBJ_UNMANAGED) == 0 ||
@@ -1961,6 +1962,7 @@ vm_object_page_remove(vm_object_t object, vm_pindex_t 
 	if (object->resident_page_count == 0)
 		return;
 	vm_object_pip_add(object, 1);
+	TAILQ_INIT(&pgl);
 again:
 	p = vm_page_find_least(object, start);
 	mtx = NULL;
@@ -2012,10 +2014,13 @@ again:
 		}
 		if ((options & OBJPR_NOTMAPPED) == 0)
 			pmap_remove_all(p);
-		vm_page_free(p);
+		p->flags &= ~PG_ZERO;
+		if (vm_page_free_prep(p, false))
+			TAILQ_INSERT_TAIL(&pgl, p, listq);
 	}
 	if (mtx != NULL)
 		mtx_unlock(mtx);
+	vm_page_free_phys_pglist(&pgl);
 	vm_object_pip_wakeup(object);
 }
 


More information about the svn-src-all mailing list