Mark some more hot global variables with __read_mostly.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2019-12-04 21:26:03 +00:00
parent 18cf0a022e
commit 61322a0a8a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355404
9 changed files with 37 additions and 36 deletions

View File

@ -214,7 +214,7 @@ static struct cdevsw xpt_cdevsw = {
/* Storage for debugging datastructures */ /* Storage for debugging datastructures */
struct cam_path *cam_dpath; 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, SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN,
&cam_dflags, 0, "Enabled debug flags"); &cam_dflags, 0, "Enabled debug flags");
u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; u_int32_t cam_debug_delay = CAM_DEBUG_DELAY;

View File

@ -83,9 +83,9 @@ static struct g_bioq g_bio_run_up;
* pressures exist. See g_io_schedule_down() for more details * pressures exist. See g_io_schedule_down() for more details
* and limitations. * 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. * The head of the list of classifiers used in g_io_request.
@ -93,8 +93,8 @@ static uma_zone_t biozone;
* to add/remove entries to the list. * to add/remove entries to the list.
* Classifiers are invoked in registration order. * Classifiers are invoked in registration order.
*/ */
static TAILQ_HEAD(g_classifier_tailq, g_classifier_hook) static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly =
g_classifier_tailq = TAILQ_HEAD_INITIALIZER(g_classifier_tailq); TAILQ_HEAD_INITIALIZER(g_classifier_tailq);
#include <machine/atomic.h> #include <machine/atomic.h>

View File

@ -61,12 +61,12 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures");
struct sx topology_lock; struct sx topology_lock;
static struct proc *g_proc; static struct proc *g_proc;
static struct thread *g_up_td; static struct thread __read_mostly *g_up_td;
static struct thread *g_down_td; static struct thread __read_mostly *g_down_td;
static struct thread *g_event_td; static struct thread __read_mostly *g_event_td;
int g_debugflags; int __read_mostly g_debugflags;
int g_collectstats = 1; int __read_mostly g_collectstats = G_STATS_PROVIDERS;
int g_shutdown; int g_shutdown;
int g_notaste; int g_notaste;

View File

@ -82,7 +82,7 @@ struct mtx_pool {
#define mtx_pool_shift mtx_pool_header.mtxpool_shift #define mtx_pool_shift mtx_pool_header.mtxpool_shift
#define mtx_pool_next mtx_pool_header.mtxpool_next #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 */ #if UINTPTR_MAX == UINT64_MAX /* 64 bits */
# define POINTER_BITS 64 # define POINTER_BITS 64

View File

@ -217,9 +217,9 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLAG_RWTUN,
* Variable panicstr contains argument to first call to panic; used as flag * Variable panicstr contains argument to first call to panic; used as flag
* to indicate that the kernel has already called panic. * 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 */ int rebooting; /* system is rebooting */
/* /*
* Used to serialize between sysctl kern.shutdown.dumpdevname and list * Used to serialize between sysctl kern.shutdown.dumpdevname and list

View File

@ -130,7 +130,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_
* TODO: * TODO:
* allocate more timeout table slots when table overflows. * 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 * The callout cpu exec entities represent informations necessary for
@ -209,7 +210,7 @@ struct callout_cpu cc_cpu;
#define CC_UNLOCK(cc) mtx_unlock_spin(&(cc)->cc_lock) #define CC_UNLOCK(cc) mtx_unlock_spin(&(cc)->cc_lock)
#define CC_LOCK_ASSERT(cc) mtx_assert(&(cc)->cc_lock, MA_OWNED) #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 callout_cpu_init(struct callout_cpu *cc, int cpu);
static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, static void softclock_call_cc(struct callout *c, struct callout_cpu *cc,

View File

@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
#ifdef KDTRACE_HOOKS #ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h> #include <sys/dtrace_bsd.h>
int dtrace_vtime_active; int __read_mostly dtrace_vtime_active;
dtrace_vtime_switch_func_t dtrace_vtime_switch_func; dtrace_vtime_switch_func_t dtrace_vtime_switch_func;
#endif #endif

View File

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

View File

@ -149,7 +149,7 @@ struct bufdomain {
static struct buf *buf; /* buffer header pool */ static struct buf *buf; /* buffer header pool */
extern struct buf *swbuf; /* Swap 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 */ /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */
struct proc *bufdaemonproc; struct proc *bufdaemonproc;