xref: /linux/kernel/rcu/Kconfig (revision 467c890f2d1ad6de9fd1dbd196fdc8f3ee63190a)
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	select NEED_SRCU_NMI_SAFE
72	default n
73	help
74	  This option forces selection of the NEED_SRCU_NMI_SAFE
75	  Kconfig option, allowing testing of srcu_read_lock_nmisafe()
76	  and srcu_read_unlock_nmisafe() on architectures (like x86)
77	  that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
78
79config NEED_SRCU_NMI_SAFE
80	def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU
81
82config TASKS_RCU_GENERIC
83	def_bool TASKS_RCU || TASKS_RUDE_RCU || TASKS_TRACE_RCU
84	help
85	  This option enables generic infrastructure code supporting
86	  task-based RCU implementations.  Not for manual selection.
87
88config FORCE_TASKS_RCU
89	bool "Force selection of TASKS_RCU"
90	depends on RCU_EXPERT
91	select TASKS_RCU
92	default n
93	help
94	  This option force-enables a task-based RCU implementation
95	  that uses only voluntary context switch (not preemption!),
96	  idle, and user-mode execution as quiescent states.  Not for
97	  manual selection in most cases.
98
99config NEED_TASKS_RCU
100	bool
101	default n
102
103config TASKS_RCU
104	bool
105	default NEED_TASKS_RCU && PREEMPTION
106	select IRQ_WORK
107
108config FORCE_TASKS_RUDE_RCU
109	bool "Force selection of Tasks Rude RCU"
110	depends on RCU_EXPERT
111	select TASKS_RUDE_RCU
112	default n
113	help
114	  This option force-enables a task-based RCU implementation
115	  that uses only context switch (including preemption) and
116	  user-mode execution as quiescent states.  It forces IPIs and
117	  context switches on all online CPUs, including idle ones,
118	  so use with caution.	Not for manual selection in most cases.
119
120config TASKS_RUDE_RCU
121	bool
122	default n
123	select IRQ_WORK
124
125config FORCE_TASKS_TRACE_RCU
126	bool "Force selection of Tasks Trace RCU"
127	depends on RCU_EXPERT
128	select TASKS_TRACE_RCU
129	default n
130	help
131	  This option enables a task-based RCU implementation that uses
132	  explicit rcu_read_lock_trace() read-side markers, and allows
133	  these readers to appear in the idle loop as well as on the
134	  CPU hotplug code paths.  It can force IPIs on online CPUs,
135	  including idle ones, so use with caution.  Not for manual
136	  selection in most cases.
137
138config TASKS_TRACE_RCU
139	bool
140	default n
141	select IRQ_WORK
142
143config RCU_STALL_COMMON
144	def_bool TREE_RCU
145	help
146	  This option enables RCU CPU stall code that is common between
147	  the TINY and TREE variants of RCU.  The purpose is to allow
148	  the tiny variants to disable RCU CPU stall warnings, while
149	  making these warnings mandatory for the tree variants.
150
151config RCU_NEED_SEGCBLIST
152	def_bool ( TREE_RCU || TREE_SRCU || TASKS_RCU_GENERIC )
153
154config RCU_FANOUT
155	int "Tree-based hierarchical RCU fanout value"
156	range 2 64 if 64BIT
157	range 2 32 if !64BIT
158	depends on TREE_RCU && RCU_EXPERT
159	default 64 if 64BIT
160	default 32 if !64BIT
161	help
162	  This option controls the fanout of hierarchical implementations
163	  of RCU, allowing RCU to work efficiently on machines with
164	  large numbers of CPUs.  This value must be at least the fourth
165	  root of NR_CPUS, which allows NR_CPUS to be insanely large.
166	  The default value of RCU_FANOUT should be used for production
167	  systems, but if you are stress-testing the RCU implementation
168	  itself, small RCU_FANOUT values allow you to test large-system
169	  code paths on small(er) systems.
170
171	  Select a specific number if testing RCU itself.
172	  Take the default if unsure.
173
174config RCU_FANOUT_LEAF
175	int "Tree-based hierarchical RCU leaf-level fanout value"
176	range 2 64 if 64BIT && !RCU_STRICT_GRACE_PERIOD
177	range 2 32 if !64BIT && !RCU_STRICT_GRACE_PERIOD
178	range 2 3 if RCU_STRICT_GRACE_PERIOD
179	depends on TREE_RCU && RCU_EXPERT
180	default 16 if !RCU_STRICT_GRACE_PERIOD
181	default 2 if RCU_STRICT_GRACE_PERIOD
182	help
183	  This option controls the leaf-level fanout of hierarchical
184	  implementations of RCU, and allows trading off cache misses
185	  against lock contention.  Systems that synchronize their
186	  scheduling-clock interrupts for energy-efficiency reasons will
187	  want the default because the smaller leaf-level fanout keeps
188	  lock contention levels acceptably low.  Very large systems
189	  (hundreds or thousands of CPUs) will instead want to set this
190	  value to the maximum value possible in order to reduce the
191	  number of cache misses incurred during RCU's grace-period
192	  initialization.  These systems tend to run CPU-bound, and thus
193	  are not helped by synchronized interrupts, and thus tend to
194	  skew them, which reduces lock contention enough that large
195	  leaf-level fanouts work well.  That said, setting leaf-level
196	  fanout to a large number will likely cause problematic
197	  lock contention on the leaf-level rcu_node structures unless
198	  you boot with the skew_tick kernel parameter.
199
200	  Select a specific number if testing RCU itself.
201
202	  Select the maximum permissible value for large systems, but
203	  please understand that you may also need to set the skew_tick
204	  kernel boot parameter to avoid contention on the rcu_node
205	  structure's locks.
206
207	  Take the default if unsure.
208
209config RCU_BOOST
210	bool "Enable RCU priority boosting"
211	depends on (RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT) || PREEMPT_RT
212	default y if PREEMPT_RT
213	help
214	  This option boosts the priority of preempted RCU readers that
215	  block the current preemptible RCU grace period for too long.
216	  This option also prevents heavy loads from blocking RCU
217	  callback invocation.
218
219	  Say Y here if you are working with real-time apps or heavy loads
220	  Say N here if you are unsure.
221
222config RCU_BOOST_DELAY
223	int "Milliseconds to delay boosting after RCU grace-period start"
224	range 0 3000
225	depends on RCU_BOOST
226	default 500
227	help
228	  This option specifies the time to wait after the beginning of
229	  a given grace period before priority-boosting preempted RCU
230	  readers blocking that grace period.  Note that any RCU reader
231	  blocking an expedited RCU grace period is boosted immediately.
232
233	  Accept the default if unsure.
234
235config RCU_EXP_KTHREAD
236	bool "Perform RCU expedited work in a real-time kthread"
237	depends on RCU_BOOST && RCU_EXPERT
238	default !PREEMPT_RT && NR_CPUS <= 32
239	help
240	  Use this option to further reduce the latencies of expedited
241	  grace periods at the expense of being more disruptive.
242
243	  This option is disabled by default on PREEMPT_RT=y kernels which
244	  disable expedited grace periods after boot by unconditionally
245	  setting rcupdate.rcu_normal_after_boot=1.
246
247	  Accept the default if unsure.
248
249config RCU_NOCB_CPU
250	bool "Offload RCU callback processing from boot-selected CPUs"
251	depends on TREE_RCU
252	depends on RCU_EXPERT || NO_HZ_FULL
253	default n
254	help
255	  Use this option to reduce OS jitter for aggressive HPC or
256	  real-time workloads.	It can also be used to offload RCU
257	  callback invocation to energy-efficient CPUs in battery-powered
258	  asymmetric multiprocessors.  The price of this reduced jitter
259	  is that the overhead of call_rcu() increases and that some
260	  workloads will incur significant increases in context-switch
261	  rates.
262
263	  This option offloads callback invocation from the set of
264	  CPUs specified at boot time by the rcu_nocbs parameter.
265	  For each such CPU, a kthread ("rcuox/N") will be created to
266	  invoke callbacks, where the "N" is the CPU being offloaded,
267	  and where the "x" is "p" for RCU-preempt (PREEMPTION kernels)
268	  and "s" for RCU-sched (!PREEMPTION kernels).	This option
269	  also creates another kthread for each sqrt(nr_cpu_ids) CPUs
270	  ("rcuog/N", where N is the first CPU in that group to come
271	  online), which handles grace periods for its group.  Nothing
272	  prevents these kthreads from running on the specified CPUs,
273	  but (1) the kthreads may be preempted between each callback,
274	  and (2) affinity or cgroups can be used to force the kthreads
275	  to run on whatever set of CPUs is desired.
276
277	  The sqrt(nr_cpu_ids) grouping may be overridden using the
278	  rcutree.rcu_nocb_gp_stride kernel boot parameter.  This can
279	  be especially helpful for smaller numbers of CPUs, where
280	  sqrt(nr_cpu_ids) can be a bit of a blunt instrument.
281
282	  Say Y here if you need reduced OS jitter, despite added overhead.
283	  Say N here if you are unsure.
284
285config RCU_NOCB_CPU_DEFAULT_ALL
286	bool "Offload RCU callback processing from all CPUs by default"
287	depends on RCU_NOCB_CPU
288	default n
289	help
290	  Use this option to offload callback processing from all CPUs
291	  by default, in the absence of the rcu_nocbs or nohz_full boot
292	  parameter. This also avoids the need to use any boot parameters
293	  to achieve the effect of offloading all CPUs on boot.
294
295	  Say Y here if you want offload all CPUs by default on boot.
296	  Say N here if you are unsure.
297
298config RCU_NOCB_CPU_CB_BOOST
299	bool "Offload RCU callback from real-time kthread"
300	depends on RCU_NOCB_CPU && RCU_BOOST
301	default y if PREEMPT_RT
302	help
303	  Use this option to invoke offloaded callbacks as SCHED_FIFO
304	  to avoid starvation by heavy SCHED_OTHER background load.
305	  Of course, running as SCHED_FIFO during callback floods will
306	  cause the rcuo[ps] kthreads to monopolize the CPU for hundreds
307	  of milliseconds or more.  Therefore, when enabling this option,
308	  it is your responsibility to ensure that latency-sensitive
309	  tasks either run with higher priority or run on some other CPU.
310
311	  Say Y here if you want to set RT priority for offloading kthreads.
312	  Say N here if you are building a !PREEMPT_RT kernel and are unsure.
313
314config TASKS_TRACE_RCU_READ_MB
315	bool "Tasks Trace RCU readers use memory barriers in user and idle"
316	depends on RCU_EXPERT && TASKS_TRACE_RCU
317	default PREEMPT_RT || NR_CPUS < 8
318	help
319	  Use this option to further reduce the number of IPIs sent
320	  to CPUs executing in userspace or idle during tasks trace
321	  RCU grace periods.  Given that a reasonable setting of
322	  the rcupdate.rcu_task_ipi_delay kernel boot parameter
323	  eliminates such IPIs for many workloads, proper setting
324	  of this Kconfig option is important mostly for aggressive
325	  real-time installations and for battery-powered devices,
326	  hence the default chosen above.
327
328	  Say Y here if you hate IPIs.
329	  Say N here if you hate read-side memory barriers.
330	  Take the default if you are unsure.
331
332config RCU_LAZY
333	bool "RCU callback lazy invocation functionality"
334	depends on RCU_NOCB_CPU
335	default n
336	help
337	  To save power, batch RCU callbacks and delay starting the
338	  corresponding grace  period for multiple seconds.  The grace
339	  period will be started after this delay, in case of memory
340	  pressure, or if the corresponding CPU's callback list grows
341	  too large.
342
343	  These delays happen only on rcu_nocbs CPUs, that is, CPUs
344	  whose callbacks have been offloaded.
345
346	  Use the rcutree.enable_rcu_lazy=0 kernel-boot parameter to
347	  globally disable these delays.
348
349config RCU_LAZY_DEFAULT_OFF
350	bool "Turn RCU lazy invocation off by default"
351	depends on RCU_LAZY
352	default n
353	help
354	  Build the kernel with CONFIG_RCU_LAZY=y, but cause the kernel
355	  to boot with these energy-efficiency delays disabled.  Use the
356	  rcutree.enable_rcu_lazy=0 kernel-boot parameter to override
357	  the this option at boot time, thus re-enabling these delays.
358
359config RCU_DOUBLE_CHECK_CB_TIME
360	bool "RCU callback-batch backup time check"
361	depends on RCU_EXPERT
362	default n
363	help
364	  Use this option to provide more precise enforcement of the
365	  rcutree.rcu_resched_ns module parameter in situations where
366	  a single RCU callback might run for hundreds of microseconds,
367	  thus defeating the 32-callback batching used to amortize the
368	  cost of the fine-grained but expensive local_clock() function.
369
370	  This option rounds rcutree.rcu_resched_ns up to the next
371	  jiffy, and overrides the 32-callback batching if this limit
372	  is exceeded.
373
374	  Say Y here if you need tighter callback-limit enforcement.
375	  Say N here if you are unsure.
376
377endmenu # "RCU Subsystem"
378