svn commit: r312890 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Fri Jan 27 15:03:53 UTC 2017


Author: mjg
Date: Fri Jan 27 15:03:51 2017
New Revision: 312890
URL: https://svnweb.freebsd.org/changeset/base/312890

Log:
  Sprinkle __read_mostly on backoff and lock profiling code.
  
  MFC after:	1 month

Modified:
  head/sys/kern/kern_lockstat.c
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_lock.c

Modified: head/sys/kern/kern_lockstat.c
==============================================================================
--- head/sys/kern/kern_lockstat.c	Fri Jan 27 14:56:36 2017	(r312889)
+++ head/sys/kern/kern_lockstat.c	Fri Jan 27 15:03:51 2017	(r312890)
@@ -27,6 +27,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/lock.h>
 #include <sys/lockstat.h>
 #include <sys/sdt.h>
@@ -61,7 +62,7 @@ SDT_PROBE_DEFINE1(lockstat, , , sx__down
 
 SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t");
 
-int lockstat_enabled = 0;
+int __read_mostly lockstat_enabled;
 
 uint64_t 
 lockstat_nsecs(struct lock_object *lo)

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Fri Jan 27 14:56:36 2017	(r312889)
+++ head/sys/kern/kern_mutex.c	Fri Jan 27 15:03:51 2017	(r312890)
@@ -140,7 +140,7 @@ struct lock_class lock_class_mtx_spin = 
 #ifdef ADAPTIVE_MUTEXES
 static SYSCTL_NODE(_debug, OID_AUTO, mtx, CTLFLAG_RD, NULL, "mtx debugging");
 
-static struct lock_delay_config mtx_delay = {
+static struct lock_delay_config __read_mostly mtx_delay = {
 	.initial	= 1000,
 	.step		= 500,
 	.min		= 100,
@@ -171,7 +171,7 @@ LOCK_DELAY_SYSINIT(mtx_delay_sysinit);
 static SYSCTL_NODE(_debug, OID_AUTO, mtx_spin, CTLFLAG_RD, NULL,
     "mtx spin debugging");
 
-static struct lock_delay_config mtx_spin_delay = {
+static struct lock_delay_config __read_mostly mtx_spin_delay = {
 	.initial        = 1000,
 	.step           = 500,
 	.min            = 100,

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Fri Jan 27 14:56:36 2017	(r312889)
+++ head/sys/kern/kern_rwlock.c	Fri Jan 27 15:03:51 2017	(r312890)
@@ -100,7 +100,7 @@ static SYSCTL_NODE(_debug, OID_AUTO, rwl
 SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, "");
 SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
 
-static struct lock_delay_config rw_delay = {
+static struct lock_delay_config __read_mostly rw_delay = {
 	.initial	= 1000,
 	.step		= 500,
 	.min		= 100,

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Fri Jan 27 14:56:36 2017	(r312889)
+++ head/sys/kern/kern_sx.c	Fri Jan 27 15:03:51 2017	(r312890)
@@ -148,7 +148,7 @@ static SYSCTL_NODE(_debug, OID_AUTO, sx,
 SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
 SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
 
-static struct lock_delay_config sx_delay = {
+static struct lock_delay_config __read_mostly sx_delay = {
 	.initial	= 1000,
 	.step           = 500,
 	.min		= 100,

Modified: head/sys/kern/subr_lock.c
==============================================================================
--- head/sys/kern/subr_lock.c	Fri Jan 27 14:56:36 2017	(r312889)
+++ head/sys/kern/subr_lock.c	Fri Jan 27 15:03:51 2017	(r312890)
@@ -213,7 +213,7 @@ struct lock_prof_cpu {
 
 struct lock_prof_cpu *lp_cpu[MAXCPU];
 
-volatile int lock_prof_enable = 0;
+volatile int __read_mostly lock_prof_enable;
 static volatile int lock_prof_resetting;
 
 #define LPROF_SBUF_SIZE		256


More information about the svn-src-all mailing list