Those pages should already be entered, this speeds up CoW faults.
Stolen from NetBSD.
ok miod@, kettenis@
-/* $OpenBSD: uvm_fault.c,v 1.129 2022/04/04 09:27:05 kettenis Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.130 2022/06/28 10:38:55 mpi Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
return EFAULT;
}
+ /*
+ * 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