Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Oct 2018 17:49:47 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339819 - head/sys/vm
Message-ID:  <201810271749.w9RHnlU4040557@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sat Oct 27 17:49:46 2018
New Revision: 339819
URL: https://svnweb.freebsd.org/changeset/base/339819

Log:
  Eliminate typically pointless calls to vm_fault_prefault() on soft, copy-
  on-write faults.  On a page fault, when we call vm_fault_prefault(), it
  probes the pmap and the shadow chain of vm objects to see if there are
  opportunities to create read and/or execute-only mappings to neighoring
  pages.  For example, in the case of hard faults, such effort typically pays
  off, that is, mappings are created that eliminate future soft page faults.
  However, in the the case of soft, copy-on-write faults, the effort very
  rarely pays off.  (See the review for some specific data.)
  
  Reviewed by:	kib, markj
  MFC after:	3 weeks
  Differential Revision:	https://reviews.freebsd.org/D17367

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Sat Oct 27 17:21:13 2018	(r339818)
+++ head/sys/vm/vm_fault.c	Sat Oct 27 17:49:46 2018	(r339819)
@@ -1181,6 +1181,16 @@ readrest:
 			 */
 			vm_object_pip_wakeup(fs.object);
 			VM_OBJECT_WUNLOCK(fs.object);
+
+			/*
+			 * We only try to prefault read-only mappings to the
+			 * neighboring pages when this copy-on-write fault is
+			 * a hard fault.  In other cases, trying to prefault
+			 * is typically wasted effort.
+			 */
+			if (faultcount == 0)
+				faultcount = 1;
+
 			/*
 			 * Only use the new page below...
 			 */



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