Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2019 15:15:21 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r355610 - in stable/12/sys: cam geom kern
Message-ID:  <201912111515.xBBFFLRl085334@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Dec 11 15:15:21 2019
New Revision: 355610
URL: https://svnweb.freebsd.org/changeset/base/355610

Log:
  MFC r355404: Mark some more hot global variables with __read_mostly.

Modified:
  stable/12/sys/cam/cam_xpt.c
  stable/12/sys/geom/geom_io.c
  stable/12/sys/geom/geom_kern.c
  stable/12/sys/kern/kern_mtxpool.c
  stable/12/sys/kern/kern_shutdown.c
  stable/12/sys/kern/kern_timeout.c
  stable/12/sys/kern/sched_4bsd.c
  stable/12/sys/kern/sched_ule.c
  stable/12/sys/kern/vfs_bio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_xpt.c
==============================================================================
--- stable/12/sys/cam/cam_xpt.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/cam/cam_xpt.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -214,7 +214,7 @@ static struct cdevsw xpt_cdevsw = {
 
 /* Storage for debugging datastructures */
 struct cam_path *cam_dpath;
-u_int32_t cam_dflags = CAM_DEBUG_FLAGS;
+u_int32_t __read_mostly cam_dflags = CAM_DEBUG_FLAGS;
 SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN,
 	&cam_dflags, 0, "Enabled debug flags");
 u_int32_t cam_debug_delay = CAM_DEBUG_DELAY;

Modified: stable/12/sys/geom/geom_io.c
==============================================================================
--- stable/12/sys/geom/geom_io.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/geom/geom_io.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -81,9 +81,9 @@ static struct g_bioq g_bio_run_up;
  * pressures exist. See g_io_schedule_down() for more details
  * and limitations.
  */
-static volatile u_int pace;
+static volatile u_int __read_mostly pace;
 
-static uma_zone_t	biozone;
+static uma_zone_t __read_mostly biozone;
 
 /*
  * The head of the list of classifiers used in g_io_request.
@@ -91,8 +91,8 @@ static uma_zone_t	biozone;
  * to add/remove entries to the list.
  * Classifiers are invoked in registration order.
  */
-static TAILQ_HEAD(g_classifier_tailq, g_classifier_hook)
-    g_classifier_tailq = TAILQ_HEAD_INITIALIZER(g_classifier_tailq);
+static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly =
+    TAILQ_HEAD_INITIALIZER(g_classifier_tailq);
 
 #include <machine/atomic.h>
 

Modified: stable/12/sys/geom/geom_kern.c
==============================================================================
--- stable/12/sys/geom/geom_kern.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/geom/geom_kern.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -61,12 +61,12 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures");
 struct sx topology_lock;
 
 static struct proc *g_proc;
-static struct thread *g_up_td;
-static struct thread *g_down_td;
-static struct thread *g_event_td;
+static struct thread __read_mostly *g_up_td;
+static struct thread __read_mostly *g_down_td;
+static struct thread __read_mostly *g_event_td;
 
-int g_debugflags;
-int g_collectstats = 1;
+int __read_mostly g_debugflags;
+int __read_mostly g_collectstats = G_STATS_PROVIDERS;
 int g_shutdown;
 int g_notaste;
 

Modified: stable/12/sys/kern/kern_mtxpool.c
==============================================================================
--- stable/12/sys/kern/kern_mtxpool.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/kern_mtxpool.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -82,7 +82,7 @@ struct mtx_pool {
 #define mtx_pool_shift	mtx_pool_header.mtxpool_shift
 #define mtx_pool_next	mtx_pool_header.mtxpool_next
 
-struct mtx_pool *mtxpool_sleep;
+struct mtx_pool __read_frequently *mtxpool_sleep;
 
 #if UINTPTR_MAX == UINT64_MAX	/* 64 bits */
 # define POINTER_BITS		64

Modified: stable/12/sys/kern/kern_shutdown.c
==============================================================================
--- stable/12/sys/kern/kern_shutdown.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/kern_shutdown.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -205,9 +205,9 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLA
  * Variable panicstr contains argument to first call to panic; used as flag
  * to indicate that the kernel has already called panic.
  */
-const char *panicstr;
+const char __read_mostly *panicstr;
 
-int dumping;				/* system is dumping */
+int __read_mostly dumping;		/* system is dumping */
 int rebooting;				/* system is rebooting */
 static struct dumperinfo dumper;	/* our selected dumper */
 

Modified: stable/12/sys/kern/kern_timeout.c
==============================================================================
--- stable/12/sys/kern/kern_timeout.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/kern_timeout.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -129,7 +129,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTU
  * TODO:
  *	allocate more timeout table slots when table overflows.
  */
-u_int callwheelsize, callwheelmask;
+static u_int __read_mostly callwheelsize;
+static u_int __read_mostly callwheelmask;
 
 /*
  * The callout cpu exec entities represent informations necessary for
@@ -202,7 +203,7 @@ struct callout_cpu cc_cpu;
 #define	CC_UNLOCK(cc)	mtx_unlock_spin(&(cc)->cc_lock)
 #define	CC_LOCK_ASSERT(cc)	mtx_assert(&(cc)->cc_lock, MA_OWNED)
 
-static int timeout_cpu;
+static int __read_mostly timeout_cpu;
 
 static void	callout_cpu_init(struct callout_cpu *cc, int cpu);
 static void	softclock_call_cc(struct callout *c, struct callout_cpu *cc,

Modified: stable/12/sys/kern/sched_4bsd.c
==============================================================================
--- stable/12/sys/kern/sched_4bsd.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/sched_4bsd.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef KDTRACE_HOOKS
 #include <sys/dtrace_bsd.h>
-int				dtrace_vtime_active;
+int __read_mostly		dtrace_vtime_active;
 dtrace_vtime_switch_func_t	dtrace_vtime_switch_func;
 #endif
 

Modified: stable/12/sys/kern/sched_ule.c
==============================================================================
--- stable/12/sys/kern/sched_ule.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/sched_ule.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef KDTRACE_HOOKS
 #include <sys/dtrace_bsd.h>
-int				dtrace_vtime_active;
+int __read_mostly		dtrace_vtime_active;
 dtrace_vtime_switch_func_t	dtrace_vtime_switch_func;
 #endif
 
@@ -206,23 +206,23 @@ _Static_assert(sizeof(struct thread) + sizeof(struct t
  * sched_slice:		Runtime of each thread before rescheduling.
  * preempt_thresh:	Priority threshold for preemption and remote IPIs.
  */
-static int sched_interact = SCHED_INTERACT_THRESH;
-static int tickincr = 8 << SCHED_TICK_SHIFT;
-static int realstathz = 127;	/* reset during boot. */
-static int sched_slice = 10;	/* reset during boot. */
-static int sched_slice_min = 1;	/* reset during boot. */
+static int __read_mostly sched_interact = SCHED_INTERACT_THRESH;
+static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT;
+static int __read_mostly realstathz = 127;	/* reset during boot. */
+static int __read_mostly sched_slice = 10;	/* reset during boot. */
+static int __read_mostly sched_slice_min = 1;	/* reset during boot. */
 #ifdef PREEMPTION
 #ifdef FULL_PREEMPTION
-static int preempt_thresh = PRI_MAX_IDLE;
+static int __read_mostly preempt_thresh = PRI_MAX_IDLE;
 #else
-static int preempt_thresh = PRI_MIN_KERN;
+static int __read_mostly preempt_thresh = PRI_MIN_KERN;
 #endif
 #else 
-static int preempt_thresh = 0;
+static int __read_mostly preempt_thresh = 0;
 #endif
-static int static_boost = PRI_MIN_BATCH;
-static int sched_idlespins = 10000;
-static int sched_idlespinthresh = -1;
+static int __read_mostly static_boost = PRI_MIN_BATCH;
+static int __read_mostly sched_idlespins = 10000;
+static int __read_mostly sched_idlespinthresh = -1;
 
 /*
  * tdq - per processor runqs and statistics.  All fields are protected by the
@@ -262,7 +262,7 @@ struct tdq {
 #define	TDQ_IDLE	2
 
 #ifdef SMP
-struct cpu_group *cpu_top;		/* CPU topology */
+struct cpu_group __read_mostly *cpu_top;		/* CPU topology */
 
 #define	SCHED_AFFINITY_DEFAULT	(max(1, hz / 1000))
 #define	SCHED_AFFINITY(ts, t)	((ts)->ts_rltick > ticks - ((t) * affinity))
@@ -272,16 +272,16 @@ struct cpu_group *cpu_top;		/* CPU topology */
  */
 static int rebalance = 1;
 static int balance_interval = 128;	/* Default set in sched_initticks(). */
-static int affinity;
-static int steal_idle = 1;
-static int steal_thresh = 2;
-static int always_steal = 0;
-static int trysteal_limit = 2;
+static int __read_mostly affinity;
+static int __read_mostly steal_idle = 1;
+static int __read_mostly steal_thresh = 2;
+static int __read_mostly always_steal = 0;
+static int __read_mostly trysteal_limit = 2;
 
 /*
  * One thread queue per processor.
  */
-static struct tdq	*balance_tdq;
+static struct tdq __read_mostly *balance_tdq;
 static int balance_ticks;
 DPCPU_DEFINE_STATIC(struct tdq, tdq);
 DPCPU_DEFINE_STATIC(uint32_t, randomval);

Modified: stable/12/sys/kern/vfs_bio.c
==============================================================================
--- stable/12/sys/kern/vfs_bio.c	Wed Dec 11 14:54:29 2019	(r355609)
+++ stable/12/sys/kern/vfs_bio.c	Wed Dec 11 15:15:21 2019	(r355610)
@@ -148,7 +148,7 @@ struct bufdomain {
 
 static struct buf *buf;		/* buffer header pool */
 extern struct buf *swbuf;	/* Swap buffer header pool. */
-caddr_t unmapped_buf;
+caddr_t __read_mostly unmapped_buf;
 
 /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */
 struct proc *bufdaemonproc;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912111515.xBBFFLRl085334>