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	help
12	  This option selects the RCU implementation that is
13	  designed for very large SMP system with hundreds or
14	  thousands of CPUs.  It also scales down nicely to
15	  smaller systems.
16
17config PREEMPT_RCU
18	bool
19	default y if PREEMPTION
20	select TREE_RCU
21	help
22	  This option selects the RCU implementation that is
23	  designed for very large SMP systems with hundreds or
24	  thousands of CPUs, but for which real-time response
25	  is also required.  It also scales down nicely to
26	  smaller systems.
27
28	  Select this option if you are unsure.
29
30config TINY_RCU
31	bool
32	default y if !PREEMPTION && !SMP
33	help
34	  This option selects the RCU implementation that is
35	  designed for UP systems from which real-time response
36	  is not required.  This option greatly reduces the
37	  memory footprint of RCU.
38
39config RCU_EXPERT
40	bool "Make expert-level adjustments to RCU configuration"
41	default n
42	help
43	  This option needs to be enabled if you wish to make
44	  expert-level adjustments to RCU configuration.  By default,
45	  no such adjustments can be made, which has the often-beneficial
46	  side-effect of preventing "make oldconfig" from asking you all
47	  sorts of detailed questions about how you would like numerous
48	  obscure RCU options to be set up.
49
50	  Say Y if you need to make expert-level adjustments to RCU.
51
52	  Say N if you are unsure.
53
54config SRCU
55	bool
56	help
57	  This option selects the sleepable version of RCU. This version
58	  permits arbitrary sleeping or blocking within RCU read-side critical
59	  sections.
60
61config TINY_SRCU
62	bool
63	default y if SRCU && TINY_RCU
64	help
65	  This option selects the single-CPU non-preemptible version of SRCU.
66
67config TREE_SRCU
68	bool
69	default y if SRCU && !TINY_RCU
70	help
71	  This option selects the full-fledged version of SRCU.
72
73config TASKS_RCU_GENERIC
74	def_bool TASKS_RCU || TASKS_RUDE_RCU || TASKS_TRACE_RCU
75	select SRCU
76	help
77	  This option enables generic infrastructure code supporting
78	  task-based RCU implementations.  Not for manual selection.
79
80config TASKS_RCU
81	def_bool PREEMPTION
82	help
83	  This option enables a task-based RCU implementation that uses
84	  only voluntary context switch (not preemption!), idle, and
85	  user-mode execution as quiescent states.  Not for manual selection.
86
87config TASKS_RUDE_RCU
88	def_bool 0
89	help
90	  This option enables a task-based RCU implementation that uses
91	  only context switch (including preemption) and user-mode
92	  execution as quiescent states.  It forces IPIs and context
93	  switches on all online CPUs, including idle ones, so use
94	  with caution.
95
96config TASKS_TRACE_RCU
97	def_bool 0
98	help
99	  This option enables a task-based RCU implementation that uses
100	  explicit rcu_read_lock_trace() read-side markers, and allows
101	  these readers to appear in the idle loop as well as on the CPU
102	  hotplug code paths.  It can force IPIs on online CPUs, including
103	  idle ones, so use with caution.
104
105config RCU_STALL_COMMON
106	def_bool TREE_RCU
107	help
108	  This option enables RCU CPU stall code that is common between
109	  the TINY and TREE variants of RCU.  The purpose is to allow
110	  the tiny variants to disable RCU CPU stall warnings, while
111	  making these warnings mandatory for the tree variants.
112
113config RCU_NEED_SEGCBLIST
114	def_bool ( TREE_RCU || TREE_SRCU )
115
116config RCU_FANOUT
117	int "Tree-based hierarchical RCU fanout value"
118	range 2 64 if 64BIT
119	range 2 32 if !64BIT
120	depends on TREE_RCU && RCU_EXPERT
121	default 64 if 64BIT
122	default 32 if !64BIT
123	help
124	  This option controls the fanout of hierarchical implementations
125	  of RCU, allowing RCU to work efficiently on machines with
126	  large numbers of CPUs.  This value must be at least the fourth
127	  root of NR_CPUS, which allows NR_CPUS to be insanely large.
128	  The default value of RCU_FANOUT should be used for production
129	  systems, but if you are stress-testing the RCU implementation
130	  itself, small RCU_FANOUT values allow you to test large-system
131	  code paths on small(er) systems.
132
133	  Select a specific number if testing RCU itself.
134	  Take the default if unsure.
135
136config RCU_FANOUT_LEAF
137	int "Tree-based hierarchical RCU leaf-level fanout value"
138	range 2 64 if 64BIT && !RCU_STRICT_GRACE_PERIOD
139	range 2 32 if !64BIT && !RCU_STRICT_GRACE_PERIOD
140	range 2 3 if RCU_STRICT_GRACE_PERIOD
141	depends on TREE_RCU && RCU_EXPERT
142	default 16 if !RCU_STRICT_GRACE_PERIOD
143	default 2 if RCU_STRICT_GRACE_PERIOD
144	help
145	  This option controls the leaf-level fanout of hierarchical
146	  implementations of RCU, and allows trading off cache misses
147	  against lock contention.  Systems that synchronize their
148	  scheduling-clock interrupts for energy-efficiency reasons will
149	  want the default because the smaller leaf-level fanout keeps
150	  lock contention levels acceptably low.  Very large systems
151	  (hundreds or thousands of CPUs) will instead want to set this
152	  value to the maximum value possible in order to reduce the
153	  number of cache misses incurred during RCU's grace-period
154	  initialization.  These systems tend to run CPU-bound, and thus
155	  are not helped by synchronized interrupts, and thus tend to
156	  skew them, which reduces lock contention enough that large
157	  leaf-level fanouts work well.  That said, setting leaf-level
158	  fanout to a large number will likely cause problematic
159	  lock contention on the leaf-level rcu_node structures unless
160	  you boot with the skew_tick kernel parameter.
161
162	  Select a specific number if testing RCU itself.
163
164	  Select the maximum permissible value for large systems, but
165	  please understand that you may also need to set the skew_tick
166	  kernel boot parameter to avoid contention on the rcu_node
167	  structure's locks.
168
169	  Take the default if unsure.
170
171config RCU_FAST_NO_HZ
172	bool "Accelerate last non-dyntick-idle CPU's grace periods"
173	depends on NO_HZ_COMMON && SMP && RCU_EXPERT
174	default n
175	help
176	  This option permits CPUs to enter dynticks-idle state even if
177	  they have RCU callbacks queued, and prevents RCU from waking
178	  these CPUs up more than roughly once every four jiffies (by
179	  default, you can adjust this using the rcutree.rcu_idle_gp_delay
180	  parameter), thus improving energy efficiency.  On the other
181	  hand, this option increases the duration of RCU grace periods,
182	  for example, slowing down synchronize_rcu().
183
184	  Say Y if energy efficiency is critically important, and you
185	  	don't care about increased grace-period durations.
186
187	  Say N if you are unsure.
188
189config RCU_BOOST
190	bool "Enable RCU priority boosting"
191	depends on RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT
192	default n
193	help
194	  This option boosts the priority of preempted RCU readers that
195	  block the current preemptible RCU grace period for too long.
196	  This option also prevents heavy loads from blocking RCU
197	  callback invocation.
198
199	  Say Y here if you are working with real-time apps or heavy loads
200	  Say N here if you are unsure.
201
202config RCU_BOOST_DELAY
203	int "Milliseconds to delay boosting after RCU grace-period start"
204	range 0 3000
205	depends on RCU_BOOST
206	default 500
207	help
208	  This option specifies the time to wait after the beginning of
209	  a given grace period before priority-boosting preempted RCU
210	  readers blocking that grace period.  Note that any RCU reader
211	  blocking an expedited RCU grace period is boosted immediately.
212
213	  Accept the default if unsure.
214
215config RCU_NOCB_CPU
216	bool "Offload RCU callback processing from boot-selected CPUs"
217	depends on TREE_RCU
218	depends on RCU_EXPERT || NO_HZ_FULL
219	default n
220	help
221	  Use this option to reduce OS jitter for aggressive HPC or
222	  real-time workloads.	It can also be used to offload RCU
223	  callback invocation to energy-efficient CPUs in battery-powered
224	  asymmetric multiprocessors.
225
226	  This option offloads callback invocation from the set of CPUs
227	  specified at boot time by the rcu_nocbs parameter.  For each
228	  such CPU, a kthread ("rcuox/N") will be created to invoke
229	  callbacks, where the "N" is the CPU being offloaded, and where
230	  the "p" for RCU-preempt (PREEMPTION kernels) and "s" for RCU-sched
231	  (!PREEMPTION kernels).  Nothing prevents this kthread from running
232	  on the specified CPUs, but (1) the kthreads may be preempted
233	  between each callback, and (2) affinity or cgroups can be used
234	  to force the kthreads to run on whatever set of CPUs is desired.
235
236	  Say Y here if you want to help to debug reduced OS jitter.
237	  Say N here if you are unsure.
238
239config TASKS_TRACE_RCU_READ_MB
240	bool "Tasks Trace RCU readers use memory barriers in user and idle"
241	depends on RCU_EXPERT
242	default PREEMPT_RT || NR_CPUS < 8
243	help
244	  Use this option to further reduce the number of IPIs sent
245	  to CPUs executing in userspace or idle during tasks trace
246	  RCU grace periods.  Given that a reasonable setting of
247	  the rcupdate.rcu_task_ipi_delay kernel boot parameter
248	  eliminates such IPIs for many workloads, proper setting
249	  of this Kconfig option is important mostly for aggressive
250	  real-time installations and for battery-powered devices,
251	  hence the default chosen above.
252
253	  Say Y here if you hate IPIs.
254	  Say N here if you hate read-side memory barriers.
255	  Take the default if you are unsure.
256
257endmenu # "RCU Subsystem"
258