From: mpi Date: Tue, 28 Jun 2022 10:38:55 +0000 (+0000) Subject: Do not consider adjacent pages when doing a CoW. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3b9e4e18a6045688c5980322a34b3085ccf120a0;p=openbsd Do not consider adjacent pages when doing a CoW. Those pages should already be entered, this speeds up CoW faults. Stolen from NetBSD. ok miod@, kettenis@ --- diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index 56a30dc9ff8..ff4fb28f51f 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -736,6 +736,16 @@ uvm_fault_check(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt, 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