xref: /linux/kernel/rcu/Kconfig (revision 12d5fc96ebbb3b948861805b32a4c3a96105ccd9)
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# RCU-related configuration options
4#
5
6menu "RCU Subsystem"
7
8config TREE_RCU
9	bool
10	default y if SMP
11	# Dynticks-idle tracking
12	select CONTEXT_TRACKING_IDLE
13	help
14	  This option selects the RCU implementation that is
15	  designed for very large SMP system with hundreds or
16	  thousands of CPUs.  It also scales down nicely to
17	  smaller systems.
18
19config PREEMPT_RCU
20	bool
21	default y if (PREEMPT || PREEMPT_RT || PREEMPT_DYNAMIC)
22	select TREE_RCU
23	help
24	  This option selects the RCU implementation that is
25	  designed for very large SMP systems with hundreds or
26	  thousands of CPUs, but for which real-time response
27	  is also required.  It also scales down nicely to
28	  smaller systems.
29
30	  Select this option if you are unsure.
31
32config TINY_RCU
33	bool
34	default y if !PREEMPT_RCU && !SMP
35	help
36	  This option selects the RCU implementation that is
37	  designed for UP systems from which real-time response
38	  is not required.  This option greatly reduces the
39	  memory footprint of RCU.
40
41config RCU_EXPERT
42	bool "Make expert-level adjustments to RCU configuration"
43	default n
44	help
45	  This option needs to be enabled if you wish to make
46	  expert-level adjustments to RCU configuration.  By default,
47	  no such adjustments can be made, which has the often-beneficial
48	  side-effect of preventing "make oldconfig" from asking you all
49	  sorts of detailed questions about how you would like numerous
50	  obscure RCU options to be set up.
51
52	  Say Y if you need to make expert-level adjustments to RCU.
53
54	  Say N if you are unsure.
55
56config TINY_SRCU
57	bool
58	default y if TINY_RCU
59	help
60	  This option selects the single-CPU non-preemptible version of SRCU.
61
62config TREE_SRCU
63	bool
64	default y if !TINY_RCU
65	help
66	  This option selects the full-fledged version of SRCU.
67
68config FORCE_NEED_SRCU_NMI_SAFE
69	bool "Force selection of NEED_SRCU_NMI_SAFE"
70	depends on !TINY_SRCU
71	depends on RCU_EXPERT
72	depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
73	select NEED_SRCU_NMI_SAFE
74	default n
75	help
76	  This option forces selection of the NEED_SRCU_NMI_SAFE
77	  Kconfig option, allowing testing of srcu_read_lock_nmisafe()
78	  and srcu_read_unlock_nmisafe() on architectures (like x86)
79	  that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
80
81config NEED_SRCU_NMI_SAFE
82	def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU
83
84config TASKS_RCU_GENERIC
85	def_bool TASKS_RCU || TASKS_RUDE_RCU
86	help
87	  This option enables generic infrastructure code supporting
88	  task-based RCU implementations.  Not for manual selection.
89
90config FORCE_TASKS_RCU
91	bool "Force selection of TASKS_RCU"
92	depends on RCU_EXPERT
93	select TASKS_RCU
94	default n
95	help
96	  This option force-enables a task-based RCU implementation
97	  that uses only voluntary context switch (not preemption!),
98	  idle, and user-mode execution as quiescent states.  Not for
99	  manual selection in most cases.
100
101config NEED_TASKS_RCU
102	bool
103	default n
104
105config TASKS_RCU
106	bool
107	default NEED_TASKS_RCU && PREEMPTION
108	select IRQ_WORK
109
110config FORCE_TASKS_RUDE_RCU
111	bool "Force selection of Tasks Rude RCU"
112	depends on RCU_EXPERT
113	select TASKS_RUDE_RCU
114	default n
115	help
116	  This option force-enables a task-based RCU implementation
117	  that uses only context switch (including preemption) and
118	  user-mode execution as quiescent states.  It forces IPIs and
119	  context switches on all online CPUs, including idle ones,
120	  so use with caution.	Not for manual selection in most cases.
121
122config TASKS_RUDE_RCU
123	bool
124	default n
125	select IRQ_WORK
126
127config FORCE_TASKS_TRACE_RCU
128	bool "Force selection of Tasks Trace RCU"
129	depends on RCU_EXPERT
130	select TASKS_TRACE_RCU
131	default n
132	help
133	  This option enables a task-based RCU implementation that uses
134	  explicit rcu_read_lock_trace() read-side markers, and allows
135	  these readers to appear in the idle loop as well as on the
136	  CPU hotplug code paths.  It can force IPIs on online CPUs,
137	  including idle ones, so use with caution.  Not for manual
138	  selection in most cases.
139
140config TASKS_TRACE_RCU
141	bool
142	default n
143
144config TASKS_TRACE_RCU_NO_MB
145	bool "Override RCU Tasks Trace inclusion of read-side memory barriers"
146	depends on RCU_EXPERT && TASKS_TRACE_RCU
147	default ARCH_WANTS_NO_INSTR
148	help
149	  This option prevents the use of read-side memory barriers in
150	  rcu_read_lock_tasks_trace() and rcu_read_unlock_tasks_trace()
151	  even in kernels built with CONFIG_ARCH_WANTS_NO_INSTR=n, that is,
152	  in kernels that do not have noinstr set up in entry/exit code.
153	  By setting this option, you are promising to carefully review
154	  use of ftrace, BPF, and friends to ensure that no tracing
155	  operation is attached to a function that runs in that portion
156	  of the entry/exit code that RCU does not watch, that is,
157	  where rcu_is_watching() returns false.  Alternatively, you
158	  might choose to never remove traces except by rebooting.
159
160	  Those wishing to disable read-side memory barriers for an entire
161	  architecture can select this Kconfig option, hence the polarity.
162
163	  Say Y here if you need speed and will review use of tracing.
164	  Say N here for certain esoteric testing of RCU itself.
165	  Take the default if you are unsure.
166
167config RCU_STALL_COMMON
168	def_bool TREE_RCU
169	help
170	  This option enables RCU CPU stall code that is common between
171	  the TINY and TREE variants of RCU.  The purpose is to allow
172	  the tiny variants to disable RCU CPU stall warnings, while
173	  making these warnings mandatory for the tree variants.
174
175config RCU_NEED_SEGCBLIST
176	def_bool ( TREE_RCU || TREE_SRCU || TASKS_RCU_GENERIC )
177
178# The deferral (and the IRQ_WORK it uses) is only needed where call_rcu() /
179# call_srcu() can be invoked while a callback-list operation is in flight.
180config RCU_DEFER
181	def_bool HAVE_NMI || KPROBES || FUNCTION_TRACER || TRACEPOINTS
182	select IRQ_WORK
183
184config RCU_FANOUT
185	int "Tree-based hierarchical RCU fanout value"
186	range 2 64 if 64BIT
187	range 2 32 if !64BIT
188	depends on TREE_RCU && RCU_EXPERT
189	default 64 if 64BIT
190	default 32 if !64BIT
191	help
192	  This option controls the fanout of hierarchical implementations
193	  of RCU, allowing RCU to work efficiently on machines with
194	  large numbers of CPUs.  This value must be at least the fourth
195	  root of NR_CPUS, which allows NR_CPUS to be insanely large.
196	  The default value of RCU_FANOUT should be used for production
197	  systems, but if you are stress-testing the RCU implementation
198	  itself, small RCU_FANOUT values allow you to test large-system
199	  code paths on small(er) systems.
200
201	  Select a specific number if testing RCU itself.
202	  Take the default if unsure.
203
204config RCU_FANOUT_LEAF
205	int "Tree-based hierarchical RCU leaf-level fanout value"
206	range 2 64 if 64BIT && !RCU_STRICT_GRACE_PERIOD
207	range 2 32 if !64BIT && !RCU_STRICT_GRACE_PERIOD
208	range 2 3 if RCU_STRICT_GRACE_PERIOD
209	depends on TREE_RCU && RCU_EXPERT
210	default 16 if !RCU_STRICT_GRACE_PERIOD
211	default 2 if RCU_STRICT_GRACE_PERIOD
212	help
213	  This option controls the leaf-level fanout of hierarchical
214	  implementations of RCU, and allows trading off cache misses
215	  against lock contention.  Systems that synchronize their
216	  scheduling-clock interrupts for energy-efficiency reasons will
217	  want the default because the smaller leaf-level fanout keeps
218	  lock contention levels acceptably low.  Very large systems
219	  (hundreds or thousands of CPUs) will instead want to set this
220	  value to the maximum value possible in order to reduce the
221	  number of cache misses incurred during RCU's grace-period
222	  initialization.  These systems tend to run CPU-bound, and thus
223	  are not helped by synchronized interrupts, and thus tend to
224	  skew them, which reduces lock contention enough that large
225	  leaf-level fanouts work well.  That said, setting leaf-level
226	  fanout to a large number will likely cause problematic
227	  lock contention on the leaf-level rcu_node structures unless
228	  you boot with the skew_tick kernel parameter.
229
230	  Select a specific number if testing RCU itself.
231
232	  Select the maximum permissible value for large systems, but
233	  please understand that you may also need to set the skew_tick
234	  kernel boot parameter to avoid contention on the rcu_node
235	  structure's locks.
236
237	  Take the default if unsure.
238
239config RCU_BOOST
240	bool "Enable RCU priority boosting"
241	depends on (RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT) || PREEMPT_RT
242	default y if PREEMPT_RT
243	help
244	  This option boosts the priority of preempted RCU readers that
245	  block the current preemptible RCU grace period for too long.
246	  This option also prevents heavy loads from blocking RCU
247	  callback invocation.
248
249	  Say Y here if you are working with real-time apps or heavy loads
250	  Say N here if you are unsure.
251
252config RCU_BOOST_DELAY
253	int "Milliseconds to delay boosting after RCU grace-period start"
254	range 0 3000
255	depends on RCU_BOOST
256	default 500
257	help
258	  This option specifies the time to wait after the beginning of
259	  a given grace period before priority-boosting preempted RCU
260	  readers blocking that grace period.  Note that any RCU reader
261	  blocking an expedited RCU grace period is boosted immediately.
262
263	  Accept the default if unsure.
264
265config RCU_EXP_KTHREAD
266	bool "Perform RCU expedited work in a real-time kthread"
267	depends on RCU_BOOST && RCU_EXPERT
268	default !PREEMPT_RT && NR_CPUS <= 32
269	help
270	  Use this option to further reduce the latencies of expedited
271	  grace periods at the expense of being more disruptive.
272
273	  This option is disabled by default on PREEMPT_RT=y kernels which
274	  disable expedited grace periods after boot by unconditionally
275	  setting rcupdate.rcu_normal_after_boot=1.
276
277	  Accept the default if unsure.
278
279config RCU_NOCB_CPU
280	bool "Offload RCU callback processing from boot-selected CPUs"
281	depends on TREE_RCU
282	depends on RCU_EXPERT || NO_HZ_FULL
283	default n
284	help
285	  Use this option to reduce OS jitter for aggressive HPC or
286	  real-time workloads.	It can also be used to offload RCU
287	  callback invocation to energy-efficient CPUs in battery-powered
288	  asymmetric multiprocessors.  The price of this reduced jitter
289	  is that the overhead of call_rcu() increases and that some
290	  workloads will incur significant increases in context-switch
291	  rates.
292
293	  This option offloads callback invocation from the set of
294	  CPUs specified at boot time by the rcu_nocbs parameter.
295	  For each such CPU, a kthread ("rcuox/N") will be created to
296	  invoke callbacks, where the "N" is the CPU being offloaded,
297	  and where the "x" is "p" for RCU-preempt (PREEMPTION kernels)
298	  and "s" for RCU-sched (!PREEMPTION kernels).	This option
299	  also creates another kthread for each sqrt(nr_cpu_ids) CPUs
300	  ("rcuog/N", where N is the first CPU in that group to come
301	  online), which handles grace periods for its group.  Nothing
302	  prevents these kthreads from running on the specified CPUs,
303	  but (1) the kthreads may be preempted between each callback,
304	  and (2) affinity or cgroups can be used to force the kthreads
305	  to run on whatever set of CPUs is desired.
306
307	  The sqrt(nr_cpu_ids) grouping may be overridden using the
308	  rcutree.rcu_nocb_gp_stride kernel boot parameter.  This can
309	  be especially helpful for smaller numbers of CPUs, where
310	  sqrt(nr_cpu_ids) can be a bit of a blunt instrument.
311
312	  Say Y here if you need reduced OS jitter, despite added overhead.
313	  Say N here if you are unsure.
314
315config RCU_NOCB_CPU_DEFAULT_ALL
316	bool "Offload RCU callback processing from all CPUs by default"
317	depends on RCU_NOCB_CPU
318	default n
319	help
320	  Use this option to offload callback processing from all CPUs
321	  by default, in the absence of the rcu_nocbs or nohz_full boot
322	  parameter. This also avoids the need to use any boot parameters
323	  to achieve the effect of offloading all CPUs on boot.
324
325	  Say Y here if you want offload all CPUs by default on boot.
326	  Say N here if you are unsure.
327
328config RCU_NOCB_CPU_CB_BOOST
329	bool "Offload RCU callback from real-time kthread"
330	depends on RCU_NOCB_CPU && RCU_BOOST
331	default y if PREEMPT_RT
332	help
333	  Use this option to invoke offloaded callbacks as SCHED_FIFO
334	  to avoid starvation by heavy SCHED_OTHER background load.
335	  Of course, running as SCHED_FIFO during callback floods will
336	  cause the rcuo[ps] kthreads to monopolize the CPU for hundreds
337	  of milliseconds or more.  Therefore, when enabling this option,
338	  it is your responsibility to ensure that latency-sensitive
339	  tasks either run with higher priority or run on some other CPU.
340
341	  Say Y here if you want to set RT priority for offloading kthreads.
342	  Say N here if you are building a !PREEMPT_RT kernel and are unsure.
343
344config RCU_LAZY
345	bool "RCU callback lazy invocation functionality"
346	depends on RCU_NOCB_CPU
347	default n
348	help
349	  To save power, batch RCU callbacks and delay starting the
350	  corresponding grace  period for multiple seconds.  The grace
351	  period will be started after this delay, in case of memory
352	  pressure, or if the corresponding CPU's callback list grows
353	  too large.
354
355	  These delays happen only on rcu_nocbs CPUs, that is, CPUs
356	  whose callbacks have been offloaded.
357
358	  Use the rcutree.enable_rcu_lazy=0 kernel-boot parameter to
359	  globally disable these delays.
360
361config RCU_LAZY_DEFAULT_OFF
362	bool "Turn RCU lazy invocation off by default"
363	depends on RCU_LAZY
364	default n
365	help
366	  Build the kernel with CONFIG_RCU_LAZY=y, but cause the kernel
367	  to boot with these energy-efficiency delays disabled.  Use the
368	  rcutree.enable_rcu_lazy=0 kernel-boot parameter to override
369	  the this option at boot time, thus re-enabling these delays.
370
371config RCU_DOUBLE_CHECK_CB_TIME
372	bool "RCU callback-batch backup time check"
373	depends on RCU_EXPERT
374	default n
375	help
376	  Use this option to provide more precise enforcement of the
377	  rcutree.rcu_resched_ns module parameter in situations where
378	  a single RCU callback might run for hundreds of microseconds,
379	  thus defeating the 32-callback batching used to amortize the
380	  cost of the fine-grained but expensive local_clock() function.
381
382	  This option rounds rcutree.rcu_resched_ns up to the next
383	  jiffy, and overrides the 32-callback batching if this limit
384	  is exceeded.
385
386	  Say Y here if you need tighter callback-limit enforcement.
387	  Say N here if you are unsure.
388
389endmenu # "RCU Subsystem"
390