Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm uvm_fault_check(): if MADV_SEQUENTIAL, change lower ...



details:   https://anonhg.NetBSD.org/src/rev/6a30823b4670
branches:  trunk
changeset: 1009143:6a30823b4670
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Apr 13 22:22:19 2020 +0000

description:
uvm_fault_check(): if MADV_SEQUENTIAL, change lower lock type to RW_WRITER
in case many threads are concurrently doing "sequential" access, to avoid
excessive mixing of read/write lock holds.

diffstat:

 sys/uvm/uvm_fault.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r e7596eb1e9c2 -r 6a30823b4670 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Mon Apr 13 20:44:39 2020 +0000
+++ b/sys/uvm/uvm_fault.c       Mon Apr 13 22:22:19 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.224 2020/03/23 10:35:56 skrll Exp $    */
+/*     $NetBSD: uvm_fault.c,v 1.225 2020/04/13 22:22:19 ad Exp $       */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.224 2020/03/23 10:35:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.225 2020/04/13 22:22:19 ad Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -1184,10 +1184,15 @@
                if (amap)
                        uvmfault_anonflush(*ranons, nback);
 
-               /* flush object? */
+               /*
+                * flush object?  change lock type to RW_WRITER, to avoid
+                * excessive competition between read/write locks if many
+                * threads doing "sequential access".
+                */
                if (uobj) {
                        voff_t uoff;
 
+                       flt->lower_lock_type = RW_WRITER;
                        uoff = ufi->entry->offset + eoff;
                        rw_enter(uobj->vmobjlock, RW_WRITER);
                        (void) (uobj->pgops->pgo_put)(uobj, uoff, uoff +



Home | Main Index | Thread Index | Old Index