Module Name:    src
Committed By:   ad
Date:           Thu Jan 30 12:28:51 UTC 2020

Modified Files:
        src/sys/uvm: uvm_pdpolicy_clock.c uvm_pdpolicy_clockpro.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/uvm_pdpolicy_clockpro.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.31 src/sys/uvm/uvm_pdpolicy_clock.c:1.32
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.31	Tue Jan 21 20:37:06 2020
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Thu Jan 30 12:28:51 2020
@@ -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 @@ uvmpdpol_estimatepageable(int *active, i
 {
 	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)

Index: src/sys/uvm/uvm_pdpolicy_clockpro.c
diff -u src/sys/uvm/uvm_pdpolicy_clockpro.c:1.22 src/sys/uvm/uvm_pdpolicy_clockpro.c:1.23
--- src/sys/uvm/uvm_pdpolicy_clockpro.c:1.22	Tue Dec 31 22:42:51 2019
+++ src/sys/uvm/uvm_pdpolicy_clockpro.c	Thu Jan 30 12:28:51 2020
@@ -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 @@ uvmpdpol_estimatepageable(int *active, i
 {
 	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

Reply via email to