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