svn commit: r349841 - head/sys/vm

Mark Johnston markj at FreeBSD.org
Mon Jul 8 19:02:41 UTC 2019


Author: markj
Date: Mon Jul  8 19:02:40 2019
New Revision: 349841
URL: https://svnweb.freebsd.org/changeset/base/349841

Log:
  Elide the vm_reserv_free_page() call when PG_PCPU_CACHE is set.
  
  Pages with PG_PCPU_CACHE set cannot have been allocated from a
  reservation, so as an optimization, skip the call to
  vm_reserv_free_page() in this case.  Otherwise, the access of
  the corresponding reservation structure often results in a cache
  miss.
  
  Reviewed by:	alc, kib
  Discussed with:	jeff
  MFC after:	2 weeks
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D20859

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Mon Jul  8 18:56:30 2019	(r349840)
+++ head/sys/vm/vm_page.c	Mon Jul  8 19:02:40 2019	(r349841)
@@ -3491,7 +3491,12 @@ vm_page_free_prep(vm_page_t m)
 		pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT);
 
 #if VM_NRESERVLEVEL > 0
-	if (vm_reserv_free_page(m))
+	/*
+	 * Determine whether the page belongs to a reservation.  If the page was
+	 * allocated from a per-CPU cache, it cannot belong to a reservation, so
+	 * as an optimization, we avoid the check in that case.
+	 */
+	if ((m->flags & PG_PCPU_CACHE) == 0 && vm_reserv_free_page(m))
 		return (false);
 #endif
 


More information about the svn-src-head mailing list