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 select IRQ_WORK 144 145config TASKS_TRACE_RCU_NO_MB 146 bool "Override RCU Tasks Trace inclusion of read-side memory barriers" 147 depends on RCU_EXPERT && TASKS_TRACE_RCU 148 default ARCH_WANTS_NO_INSTR 149 help 150 This option prevents the use of read-side memory barriers in 151 rcu_read_lock_tasks_trace() and rcu_read_unlock_tasks_trace() 152 even in kernels built with CONFIG_ARCH_WANTS_NO_INSTR=n, that is, 153 in kernels that do not have noinstr set up in entry/exit code. 154 By setting this option, you are promising to carefully review 155 use of ftrace, BPF, and friends to ensure that no tracing 156 operation is attached to a function that runs in that portion 157 of the entry/exit code that RCU does not watch, that is, 158 where rcu_is_watching() returns false. Alternatively, you 159 might choose to never remove traces except by rebooting. 160 161 Those wishing to disable read-side memory barriers for an entire 162 architecture can select this Kconfig option, hence the polarity. 163 164 Say Y here if you need speed and will review use of tracing. 165 Say N here for certain esoteric testing of RCU itself. 166 Take the default if you are unsure. 167 168config RCU_STALL_COMMON 169 def_bool TREE_RCU 170 help 171 This option enables RCU CPU stall code that is common between 172 the TINY and TREE variants of RCU. The purpose is to allow 173 the tiny variants to disable RCU CPU stall warnings, while 174 making these warnings mandatory for the tree variants. 175 176config RCU_NEED_SEGCBLIST 177 def_bool ( TREE_RCU || TREE_SRCU || TASKS_RCU_GENERIC ) 178 179config RCU_FANOUT 180 int "Tree-based hierarchical RCU fanout value" 181 range 2 64 if 64BIT 182 range 2 32 if !64BIT 183 depends on TREE_RCU && RCU_EXPERT 184 default 64 if 64BIT 185 default 32 if !64BIT 186 help 187 This option controls the fanout of hierarchical implementations 188 of RCU, allowing RCU to work efficiently on machines with 189 large numbers of CPUs. This value must be at least the fourth 190 root of NR_CPUS, which allows NR_CPUS to be insanely large. 191 The default value of RCU_FANOUT should be used for production 192 systems, but if you are stress-testing the RCU implementation 193 itself, small RCU_FANOUT values allow you to test large-system 194 code paths on small(er) systems. 195 196 Select a specific number if testing RCU itself. 197 Take the default if unsure. 198 199config RCU_FANOUT_LEAF 200 int "Tree-based hierarchical RCU leaf-level fanout value" 201 range 2 64 if 64BIT && !RCU_STRICT_GRACE_PERIOD 202 range 2 32 if !64BIT && !RCU_STRICT_GRACE_PERIOD 203 range 2 3 if RCU_STRICT_GRACE_PERIOD 204 depends on TREE_RCU && RCU_EXPERT 205 default 16 if !RCU_STRICT_GRACE_PERIOD 206 default 2 if RCU_STRICT_GRACE_PERIOD 207 help 208 This option controls the leaf-level fanout of hierarchical 209 implementations of RCU, and allows trading off cache misses 210 against lock contention. Systems that synchronize their 211 scheduling-clock interrupts for energy-efficiency reasons will 212 want the default because the smaller leaf-level fanout keeps 213 lock contention levels acceptably low. Very large systems 214 (hundreds or thousands of CPUs) will instead want to set this 215 value to the maximum value possible in order to reduce the 216 number of cache misses incurred during RCU's grace-period 217 initialization. These systems tend to run CPU-bound, and thus 218 are not helped by synchronized interrupts, and thus tend to 219 skew them, which reduces lock contention enough that large 220 leaf-level fanouts work well. That said, setting leaf-level 221 fanout to a large number will likely cause problematic 222 lock contention on the leaf-level rcu_node structures unless 223 you boot with the skew_tick kernel parameter. 224 225 Select a specific number if testing RCU itself. 226 227 Select the maximum permissible value for large systems, but 228 please understand that you may also need to set the skew_tick 229 kernel boot parameter to avoid contention on the rcu_node 230 structure's locks. 231 232 Take the default if unsure. 233 234config RCU_BOOST 235 bool "Enable RCU priority boosting" 236 depends on (RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT) || PREEMPT_RT 237 default y if PREEMPT_RT 238 help 239 This option boosts the priority of preempted RCU readers that 240 block the current preemptible RCU grace period for too long. 241 This option also prevents heavy loads from blocking RCU 242 callback invocation. 243 244 Say Y here if you are working with real-time apps or heavy loads 245 Say N here if you are unsure. 246 247config RCU_BOOST_DELAY 248 int "Milliseconds to delay boosting after RCU grace-period start" 249 range 0 3000 250 depends on RCU_BOOST 251 default 500 252 help 253 This option specifies the time to wait after the beginning of 254 a given grace period before priority-boosting preempted RCU 255 readers blocking that grace period. Note that any RCU reader 256 blocking an expedited RCU grace period is boosted immediately. 257 258 Accept the default if unsure. 259 260config RCU_EXP_KTHREAD 261 bool "Perform RCU expedited work in a real-time kthread" 262 depends on RCU_BOOST && RCU_EXPERT 263 default !PREEMPT_RT && NR_CPUS <= 32 264 help 265 Use this option to further reduce the latencies of expedited 266 grace periods at the expense of being more disruptive. 267 268 This option is disabled by default on PREEMPT_RT=y kernels which 269 disable expedited grace periods after boot by unconditionally 270 setting rcupdate.rcu_normal_after_boot=1. 271 272 Accept the default if unsure. 273 274config RCU_NOCB_CPU 275 bool "Offload RCU callback processing from boot-selected CPUs" 276 depends on TREE_RCU 277 depends on RCU_EXPERT || NO_HZ_FULL 278 default n 279 help 280 Use this option to reduce OS jitter for aggressive HPC or 281 real-time workloads. It can also be used to offload RCU 282 callback invocation to energy-efficient CPUs in battery-powered 283 asymmetric multiprocessors. The price of this reduced jitter 284 is that the overhead of call_rcu() increases and that some 285 workloads will incur significant increases in context-switch 286 rates. 287 288 This option offloads callback invocation from the set of 289 CPUs specified at boot time by the rcu_nocbs parameter. 290 For each such CPU, a kthread ("rcuox/N") will be created to 291 invoke callbacks, where the "N" is the CPU being offloaded, 292 and where the "x" is "p" for RCU-preempt (PREEMPTION kernels) 293 and "s" for RCU-sched (!PREEMPTION kernels). This option 294 also creates another kthread for each sqrt(nr_cpu_ids) CPUs 295 ("rcuog/N", where N is the first CPU in that group to come 296 online), which handles grace periods for its group. Nothing 297 prevents these kthreads from running on the specified CPUs, 298 but (1) the kthreads may be preempted between each callback, 299 and (2) affinity or cgroups can be used to force the kthreads 300 to run on whatever set of CPUs is desired. 301 302 The sqrt(nr_cpu_ids) grouping may be overridden using the 303 rcutree.rcu_nocb_gp_stride kernel boot parameter. This can 304 be especially helpful for smaller numbers of CPUs, where 305 sqrt(nr_cpu_ids) can be a bit of a blunt instrument. 306 307 Say Y here if you need reduced OS jitter, despite added overhead. 308 Say N here if you are unsure. 309 310config RCU_NOCB_CPU_DEFAULT_ALL 311 bool "Offload RCU callback processing from all CPUs by default" 312 depends on RCU_NOCB_CPU 313 default n 314 help 315 Use this option to offload callback processing from all CPUs 316 by default, in the absence of the rcu_nocbs or nohz_full boot 317 parameter. This also avoids the need to use any boot parameters 318 to achieve the effect of offloading all CPUs on boot. 319 320 Say Y here if you want offload all CPUs by default on boot. 321 Say N here if you are unsure. 322 323config RCU_NOCB_CPU_CB_BOOST 324 bool "Offload RCU callback from real-time kthread" 325 depends on RCU_NOCB_CPU && RCU_BOOST 326 default y if PREEMPT_RT 327 help 328 Use this option to invoke offloaded callbacks as SCHED_FIFO 329 to avoid starvation by heavy SCHED_OTHER background load. 330 Of course, running as SCHED_FIFO during callback floods will 331 cause the rcuo[ps] kthreads to monopolize the CPU for hundreds 332 of milliseconds or more. Therefore, when enabling this option, 333 it is your responsibility to ensure that latency-sensitive 334 tasks either run with higher priority or run on some other CPU. 335 336 Say Y here if you want to set RT priority for offloading kthreads. 337 Say N here if you are building a !PREEMPT_RT kernel and are unsure. 338 339config RCU_LAZY 340 bool "RCU callback lazy invocation functionality" 341 depends on RCU_NOCB_CPU 342 default n 343 help 344 To save power, batch RCU callbacks and delay starting the 345 corresponding grace period for multiple seconds. The grace 346 period will be started after this delay, in case of memory 347 pressure, or if the corresponding CPU's callback list grows 348 too large. 349 350 These delays happen only on rcu_nocbs CPUs, that is, CPUs 351 whose callbacks have been offloaded. 352 353 Use the rcutree.enable_rcu_lazy=0 kernel-boot parameter to 354 globally disable these delays. 355 356config RCU_LAZY_DEFAULT_OFF 357 bool "Turn RCU lazy invocation off by default" 358 depends on RCU_LAZY 359 default n 360 help 361 Build the kernel with CONFIG_RCU_LAZY=y, but cause the kernel 362 to boot with these energy-efficiency delays disabled. Use the 363 rcutree.enable_rcu_lazy=0 kernel-boot parameter to override 364 the this option at boot time, thus re-enabling these delays. 365 366config RCU_DOUBLE_CHECK_CB_TIME 367 bool "RCU callback-batch backup time check" 368 depends on RCU_EXPERT 369 default n 370 help 371 Use this option to provide more precise enforcement of the 372 rcutree.rcu_resched_ns module parameter in situations where 373 a single RCU callback might run for hundreds of microseconds, 374 thus defeating the 32-callback batching used to amortize the 375 cost of the fine-grained but expensive local_clock() function. 376 377 This option rounds rcutree.rcu_resched_ns up to the next 378 jiffy, and overrides the 32-callback batching if this limit 379 is exceeded. 380 381 Say Y here if you need tighter callback-limit enforcement. 382 Say N here if you are unsure. 383 384endmenu # "RCU Subsystem" 385