Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm uvmpdpol_estimatepageable(): Don't take any locks he...



details:   https://anonhg.NetBSD.org/src/rev/11c16659a5c8
branches:  trunk
changeset: 744351:11c16659a5c8
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Jan 30 12:28:51 2020 +0000

description:
uvmpdpol_estimatepageable(): Don't take any locks here.  This can be called
from DDB, and in any case the numbers are stale the instant the lock is
dropped, so it just doesn't matter.

diffstat:

 sys/uvm/uvm_pdpolicy_clock.c    |  15 +++++++++------
 sys/uvm/uvm_pdpolicy_clockpro.c |  11 +++++++----
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (78 lines):

diff -r e0d8694925a0 -r 11c16659a5c8 sys/uvm/uvm_pdpolicy_clock.c
--- a/sys/uvm/uvm_pdpolicy_clock.c      Thu Jan 30 09:53:49 2020 +0000
+++ b/sys/uvm/uvm_pdpolicy_clock.c      Thu Jan 30 12:28:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $       */
+/*     $NetBSD: uvm_pdpolicy_clock.c,v 1.32 2020/01/30 12:28:51 ad Exp $       */
 /*     NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $     */
 
 /*-
@@ -98,7 +98,7 @@
 #else /* defined(PDSIM) */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.32 2020/01/30 12:28:51 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -568,14 +568,17 @@
 {
        struct uvmpdpol_globalstate *s = &pdpol_state;
 
-       mutex_enter(&s->lock);
+       /*
+        * Don't take any locks here.  This can be called from DDB, and in
+        * any case the numbers are stale the instant the lock is dropped,
+        * so it just doesn't matter.
+        */
        if (active) {
-               *active = pdpol_state.s_active;
+               *active = s->s_active;
        }
        if (inactive) {
-               *inactive = pdpol_state.s_inactive;
+               *inactive = s->s_inactive;
        }
-       mutex_exit(&s->lock);
 }
 
 #if !defined(PDSIM)
diff -r e0d8694925a0 -r 11c16659a5c8 sys/uvm/uvm_pdpolicy_clockpro.c
--- a/sys/uvm/uvm_pdpolicy_clockpro.c   Thu Jan 30 09:53:49 2020 +0000
+++ b/sys/uvm/uvm_pdpolicy_clockpro.c   Thu Jan 30 12:28:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdpolicy_clockpro.c,v 1.22 2019/12/31 22:42:51 ad Exp $    */
+/*     $NetBSD: uvm_pdpolicy_clockpro.c,v 1.23 2020/01/30 12:28:51 ad Exp $    */
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -43,7 +43,7 @@
 #else /* defined(PDSIM) */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.22 2019/12/31 22:42:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.23 2020/01/30 12:28:51 ad Exp $");
 
 #include "opt_ddb.h"
 
@@ -1286,14 +1286,17 @@
 {
        struct clockpro_state * const s = &clockpro;
 
-       mutex_enter(&s->lock);
+       /*
+        * Don't take any locks here.  This can be called from DDB, and in
+        * any case the numbers are stale the instant the lock is dropped,
+        * so it just doesn't matter.
+        */
        if (active) {
                *active = s->s_npages - s->s_ncold;
        }
        if (inactive) {
                *inactive = s->s_ncold;
        }
-       mutex_exit(&s->lock);
 }
 
 bool



Home | Main Index | Thread Index | Old Index