Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jul 2019 19:02:40 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349841 - head/sys/vm
Message-ID:  <201907081902.x68J2eOx063494@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907081902.x68J2eOx063494>