svn commit: r339819 - head/sys/vm
Alan Cox
alc at FreeBSD.org
Sat Oct 27 17:49:47 UTC 2018
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...
*/
More information about the svn-src-all
mailing list