1# SPDX-License-Identifier: GPL-2.0-only 2 3config PREEMPT_NONE_BUILD 4 bool 5 6config PREEMPT_VOLUNTARY_BUILD 7 bool 8 9config PREEMPT_BUILD 10 bool 11 select PREEMPTION 12 select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK 13 14config ARCH_HAS_PREEMPT_LAZY 15 bool 16 17choice 18 prompt "Preemption Model" 19 default PREEMPT_LAZY if ARCH_HAS_PREEMPT_LAZY 20 default PREEMPT_NONE 21 22config PREEMPT_NONE 23 bool "No Forced Preemption (Server)" 24 depends on !PREEMPT_RT 25 depends on ARCH_NO_PREEMPT 26 select PREEMPT_NONE_BUILD if !PREEMPT_DYNAMIC 27 help 28 This is the traditional Linux preemption model, geared towards 29 throughput. It will still provide good latencies most of the 30 time, but there are no guarantees and occasional longer delays 31 are possible. 32 33 Select this option if you are building a kernel for a server or 34 scientific/computation system, or if you want to maximize the 35 raw processing power of the kernel, irrespective of scheduling 36 latencies. 37 38config PREEMPT_VOLUNTARY 39 bool "Voluntary Kernel Preemption (Desktop)" 40 depends on !ARCH_HAS_PREEMPT_LAZY 41 depends on !ARCH_NO_PREEMPT 42 depends on !PREEMPT_RT 43 select PREEMPT_VOLUNTARY_BUILD if !PREEMPT_DYNAMIC 44 help 45 This option reduces the latency of the kernel by adding more 46 "explicit preemption points" to the kernel code. These new 47 preemption points have been selected to reduce the maximum 48 latency of rescheduling, providing faster application reactions, 49 at the cost of slightly lower throughput. 50 51 This allows reaction to interactive events by allowing a 52 low priority process to voluntarily preempt itself even if it 53 is in kernel mode executing a system call. This allows 54 applications to run more 'smoothly' even when the system is 55 under load. 56 57 Select this if you are building a kernel for a desktop system. 58 59config PREEMPT 60 bool "Preemptible Kernel (Low-Latency Desktop)" 61 depends on !ARCH_NO_PREEMPT 62 select PREEMPT_BUILD if !PREEMPT_DYNAMIC 63 help 64 This option reduces the latency of the kernel by making 65 all kernel code (that is not executing in a critical section) 66 preemptible. This allows reaction to interactive events by 67 permitting a low priority process to be preempted involuntarily 68 even if it is in kernel mode executing a system call and would 69 otherwise not be about to reach a natural preemption point. 70 This allows applications to run more 'smoothly' even when the 71 system is under load, at the cost of slightly lower throughput 72 and a slight runtime overhead to kernel code. 73 74 Select this if you are building a kernel for a desktop or 75 embedded system with latency requirements in the milliseconds 76 range. 77 78config PREEMPT_LAZY 79 bool "Scheduler controlled preemption model" 80 depends on !ARCH_NO_PREEMPT 81 depends on ARCH_HAS_PREEMPT_LAZY 82 select PREEMPT_BUILD if !PREEMPT_DYNAMIC 83 help 84 This option provides a scheduler driven preemption model that 85 is fundamentally similar to full preemption, but is less 86 eager to preempt SCHED_NORMAL tasks in an attempt to 87 reduce lock holder preemption and recover some of the performance 88 gains seen from using Voluntary preemption. 89 90endchoice 91 92config PREEMPT_RT 93 bool "Fully Preemptible Kernel (Real-Time)" 94 depends on EXPERT && ARCH_SUPPORTS_RT && !COMPILE_TEST 95 select PREEMPTION 96 help 97 This option turns the kernel into a real-time kernel by replacing 98 various locking primitives (spinlocks, rwlocks, etc.) with 99 preemptible priority-inheritance aware variants, enforcing 100 interrupt threading and introducing mechanisms to break up long 101 non-preemptible sections. This makes the kernel, except for very 102 low level and critical code paths (entry code, scheduler, low 103 level interrupt handling) fully preemptible and brings most 104 execution contexts under scheduler control. 105 106 Select this if you are building a kernel for systems which 107 require real-time guarantees. 108 109config PREEMPT_RT_NEEDS_BH_LOCK 110 bool "Enforce softirq synchronisation on PREEMPT_RT" 111 depends on PREEMPT_RT 112 help 113 Enforce synchronisation across the softirqs context. On PREEMPT_RT 114 the softirq is preemptible. This enforces the same per-CPU BLK 115 semantic non-PREEMPT_RT builds have. This should not be needed 116 because per-CPU locks were added to avoid the per-CPU BKL. 117 118 This switch provides the old behaviour for testing reasons. Select 119 this if you suspect an error with preemptible softirq and want test 120 the old synchronized behaviour. 121 122config PREEMPT_COUNT 123 bool 124 125config HAS_SEPARATE_PREEMPT_RESCHED_BITS 126 bool 127 depends on PREEMPT_COUNT && 64BIT 128 129config PREEMPTION 130 bool 131 select PREEMPT_COUNT 132 133config PREEMPT_DYNAMIC 134 bool "Preemption behaviour defined on boot" 135 depends on HAVE_PREEMPT_DYNAMIC 136 select JUMP_LABEL if HAVE_PREEMPT_DYNAMIC_KEY 137 select PREEMPT_BUILD 138 default y if HAVE_PREEMPT_DYNAMIC_CALL 139 help 140 This option allows to define the preemption model on the kernel 141 command line parameter and thus override the default preemption 142 model defined during compile time. 143 144 The feature is primarily interesting for Linux distributions which 145 provide a pre-built kernel binary to reduce the number of kernel 146 flavors they offer while still offering different usecases. 147 148 The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled 149 but if runtime patching is not available for the specific architecture 150 then the potential overhead should be considered. 151 152 Interesting if you want the same pre-built kernel should be used for 153 both Server and Desktop workloads. 154 155config SCHED_CORE 156 bool "Core Scheduling for SMT" 157 depends on SCHED_SMT 158 help 159 This option permits Core Scheduling, a means of coordinated task 160 selection across SMT siblings. When enabled -- see 161 prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings 162 will execute a task from the same 'core group', forcing idle when no 163 matching task is found. 164 165 Use of this feature includes: 166 - mitigation of some (not all) SMT side channels; 167 - limiting SMT interference to improve determinism and/or performance. 168 169 SCHED_CORE is default disabled. When it is enabled and unused, 170 which is the likely usage by Linux distributions, there should 171 be no measurable impact on performance. 172 173config SCHED_CLASS_EXT 174 bool "Extensible Scheduling Class" 175 depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF 176 select STACKTRACE if STACKTRACE_SUPPORT 177 help 178 This option enables a new scheduler class sched_ext (SCX), which 179 allows scheduling policies to be implemented as BPF programs to 180 achieve the following: 181 182 - Ease of experimentation and exploration: Enabling rapid 183 iteration of new scheduling policies. 184 - Customization: Building application-specific schedulers which 185 implement policies that are not applicable to general-purpose 186 schedulers. 187 - Rapid scheduler deployments: Non-disruptive swap outs of 188 scheduling policies in production environments. 189 190 sched_ext leverages BPF struct_ops feature to define a structure 191 which exports function callbacks and flags to BPF programs that 192 wish to implement scheduling policies. The struct_ops structure 193 exported by sched_ext is struct sched_ext_ops, and is conceptually 194 similar to struct sched_class. 195 196 For more information: 197 Documentation/scheduler/sched-ext.rst 198 https://github.com/sched-ext/scx 199