When faulting a page after COW neighborhood pages are likely to already
be entered. So speed up the fault by doing a narrow fault (do not try
to map in adjacent pages).
This is stolen from NetBSD.
ok?
Index: uvm/uvm_fault.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_fault.c,v
retrieving revision 1.129
diff -u -p -r1.129 uvm_fault.c
--- uvm/uvm_fault.c 4 Apr 2022 09:27:05 -0000 1.129
+++ uvm/uvm_fault.c 27 Jun 2022 17:05:26 -0000
@@ -737,6 +737,16 @@ uvm_fault_check(struct uvm_faultinfo *uf
}
/*
+ * for a case 2B fault waste no time on adjacent pages because
+ * they are likely already entered.
+ */
+ if (uobj != NULL && amap != NULL &&
+ (flt->access_type & PROT_WRITE) != 0) {
+ /* wide fault (!narrow) */
+ flt->narrow = TRUE;
+ }
+
+ /*
* establish range of interest based on advice from mapper
* and then clip to fit map entry. note that we only want
* to do this the first time through the fault. if we