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