diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 50c4a60bbf35..2fe6fba3250d 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -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; diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index bdade2855f8e..1cffa8be63af 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -83,9 +83,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. @@ -93,8 +93,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 diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c index 0678a8ac4be6..519f45f90c88 100644 --- a/sys/geom/geom_kern.c +++ b/sys/geom/geom_kern.c @@ -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; diff --git a/sys/kern/kern_mtxpool.c b/sys/kern/kern_mtxpool.c index 72bf0f92ed80..4b96247dde2d 100644 --- a/sys/kern/kern_mtxpool.c +++ b/sys/kern/kern_mtxpool.c @@ -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 diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index f756b43bfa73..e7139a6dab50 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -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 * 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 */ /* * Used to serialize between sysctl kern.shutdown.dumpdevname and list diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 5ee390f3fce9..cbf3df0d4663 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -130,7 +130,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_ * 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 @@ -209,7 +210,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, diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index c53b838f8db6..6f441a4f6822 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -int dtrace_vtime_active; +int __read_mostly dtrace_vtime_active; dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 61dfbdbe184e..3acd2385e0ef 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -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 td_sched) <= * 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); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index e40d2e1b443e..e657880ab2cc 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -149,7 +149,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;