1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2cc19ca86SIngo Molnar 3a8b76910SValentin Schneiderconfig PREEMPT_NONE_BUILD 4a8b76910SValentin Schneider bool 5a8b76910SValentin Schneider 6a8b76910SValentin Schneiderconfig PREEMPT_VOLUNTARY_BUILD 7a8b76910SValentin Schneider bool 8a8b76910SValentin Schneider 9a8b76910SValentin Schneiderconfig PREEMPT_BUILD 10a8b76910SValentin Schneider bool 11a8b76910SValentin Schneider select PREEMPTION 12a8b76910SValentin Schneider select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK 13a8b76910SValentin Schneider 14f8cbd99bSIngo Molnarconfig ARCH_HAS_PREEMPT_LAZY 15f8cbd99bSIngo Molnar bool 16a8b76910SValentin Schneider 17f8cbd99bSIngo Molnarchoice 18a8b76910SValentin Schneider prompt "Preemption Model" 19f8cbd99bSIngo Molnar default PREEMPT_NONE 20a8b76910SValentin Schneider 21cc19ca86SIngo Molnarconfig PREEMPT_NONE 22f8cbd99bSIngo Molnar bool "No Forced Preemption (Server)" 23f8cbd99bSIngo Molnar depends on !PREEMPT_RT 24f8cbd99bSIngo Molnar select PREEMPT_NONE_BUILD if !PREEMPT_DYNAMIC 25f8cbd99bSIngo Molnar help 26f8cbd99bSIngo Molnar This is the traditional Linux preemption model, geared towards 27f8cbd99bSIngo Molnar throughput. It will still provide good latencies most of the 28f8cbd99bSIngo Molnar time, but there are no guarantees and occasional longer delays 29f8cbd99bSIngo Molnar are possible. 30f8cbd99bSIngo Molnar 31f8cbd99bSIngo Molnar Select this option if you are building a kernel for a server or 32a8b76910SValentin Schneider scientific/computation system, or if you want to maximize the 33f8cbd99bSIngo Molnar raw processing power of the kernel, irrespective of scheduling 3487a4c375SChristoph Hellwig latencies. 35a8b76910SValentin Schneider 36f8cbd99bSIngo Molnarconfig PREEMPT_VOLUNTARY 37f8cbd99bSIngo Molnar bool "Voluntary Kernel Preemption (Desktop)" 38f8cbd99bSIngo Molnar depends on !ARCH_NO_PREEMPT 39f8cbd99bSIngo Molnar depends on !PREEMPT_RT 40f8cbd99bSIngo Molnar select PREEMPT_VOLUNTARY_BUILD if !PREEMPT_DYNAMIC 413dde6ad8SDavid Sterba help 42f8cbd99bSIngo Molnar This option reduces the latency of the kernel by adding more 43f8cbd99bSIngo Molnar "explicit preemption points" to the kernel code. These new 44f8cbd99bSIngo Molnar preemption points have been selected to reduce the maximum 45f8cbd99bSIngo Molnar latency of rescheduling, providing faster application reactions, 46f8cbd99bSIngo Molnar at the cost of slightly lower throughput. 47cc19ca86SIngo Molnar 48cc19ca86SIngo Molnar This allows reaction to interactive events by allowing a 49f8cbd99bSIngo Molnar low priority process to voluntarily preempt itself even if it 50f8cbd99bSIngo Molnar is in kernel mode executing a system call. This allows 51a8b76910SValentin Schneider applications to run more 'smoothly' even when the system is 52f8cbd99bSIngo Molnar under load. 5387a4c375SChristoph Hellwig 54a8b76910SValentin Schneider Select this if you are building a kernel for a desktop system. 55f8cbd99bSIngo Molnar 56f8cbd99bSIngo Molnarconfig PREEMPT 57f8cbd99bSIngo Molnar bool "Preemptible Kernel (Low-Latency Desktop)" 58f8cbd99bSIngo Molnar depends on !ARCH_NO_PREEMPT 59f8cbd99bSIngo Molnar select PREEMPT_BUILD if !PREEMPT_DYNAMIC 60f8cbd99bSIngo Molnar help 61f8cbd99bSIngo Molnar This option reduces the latency of the kernel by making 62f8cbd99bSIngo Molnar all kernel code (that is not executing in a critical section) 633dde6ad8SDavid Sterba preemptible. This allows reaction to interactive events by 64f8cbd99bSIngo Molnar permitting a low priority process to be preempted involuntarily 65f8cbd99bSIngo Molnar even if it is in kernel mode executing a system call and would 66f8cbd99bSIngo Molnar otherwise not be about to reach a natural preemption point. 67f8cbd99bSIngo Molnar This allows applications to run more 'smoothly' even when the 68f8cbd99bSIngo Molnar system is under load, at the cost of slightly lower throughput 69f8cbd99bSIngo Molnar and a slight runtime overhead to kernel code. 70a50a3f4bSThomas Gleixner 71a50a3f4bSThomas Gleixner Select this if you are building a kernel for a desktop or 72a8b76910SValentin Schneider embedded system with latency requirements in the milliseconds 73b8d33498SThomas Gleixner range. 74a50a3f4bSThomas Gleixner 75a50a3f4bSThomas Gleixnerconfig PREEMPT_LAZY 76a50a3f4bSThomas Gleixner bool "Scheduler controlled preemption model" 77a50a3f4bSThomas Gleixner depends on !ARCH_NO_PREEMPT 78a50a3f4bSThomas Gleixner depends on ARCH_HAS_PREEMPT_LAZY 79a50a3f4bSThomas Gleixner select PREEMPT_BUILD if !PREEMPT_DYNAMIC 80d61ca3c2SSrivatsa S. Bhat (VMware) help 81a50a3f4bSThomas Gleixner This option provides a scheduler driven preemption model that 82a50a3f4bSThomas Gleixner is fundamentally similar to full preemption, but is less 83a50a3f4bSThomas Gleixner eager to preempt SCHED_NORMAL tasks in an attempt to 84a50a3f4bSThomas Gleixner reduce lock holder preemption and recover some of the performance 85a50a3f4bSThomas Gleixner gains seen from using Voluntary preemption. 86a50a3f4bSThomas Gleixner 87f8cbd99bSIngo Molnarendchoice 88cc19ca86SIngo Molnar 89bdd4e85dSFrederic Weisbeckerconfig PREEMPT_RT 90bdd4e85dSFrederic Weisbecker bool "Fully Preemptible Kernel (Real-Time)" 91a50a3f4bSThomas Gleixner depends on EXPERT && ARCH_SUPPORTS_RT && !COMPILE_TEST 92b8d33498SThomas Gleixner select PREEMPTION 93a50a3f4bSThomas Gleixner help 94a50a3f4bSThomas Gleixner This option turns the kernel into a real-time kernel by replacing 956ef869e0SMichal Hocko various locking primitives (spinlocks, rwlocks, etc.) with 966ef869e0SMichal Hocko preemptible priority-inheritance aware variants, enforcing 97c597bfddSFrederic Weisbecker interrupt threading and introducing mechanisms to break up long 98a8b76910SValentin Schneider non-preemptible sections. This makes the kernel, except for very 9999cf983cSMark Rutland low level and critical code paths (entry code, scheduler, low 100a8b76910SValentin Schneider level interrupt handling) fully preemptible and brings most 10199cf983cSMark Rutland execution contexts under scheduler control. 1026ef869e0SMichal Hocko 1036ef869e0SMichal Hocko Select this if you are building a kernel for systems which 1046ef869e0SMichal Hocko require real-time guarantees. 1056ef869e0SMichal Hocko 1066ef869e0SMichal Hockoconfig PREEMPT_COUNT 1076ef869e0SMichal Hocko bool 1086ef869e0SMichal Hocko 1096ef869e0SMichal Hockoconfig PREEMPTION 1106ef869e0SMichal Hocko bool 1116ef869e0SMichal Hocko select PREEMPT_COUNT 1126ef869e0SMichal Hocko 1136ef869e0SMichal Hockoconfig PREEMPT_DYNAMIC 1146ef869e0SMichal Hocko bool "Preemption behaviour defined on boot" 1156ef869e0SMichal Hocko depends on HAVE_PREEMPT_DYNAMIC 1166ef869e0SMichal Hocko select JUMP_LABEL if HAVE_PREEMPT_DYNAMIC_KEY 1179edeaea1SPeter Zijlstra select PREEMPT_BUILD 1189edeaea1SPeter Zijlstra default y if HAVE_PREEMPT_DYNAMIC_CALL 1199edeaea1SPeter Zijlstra help 1209edeaea1SPeter Zijlstra This option allows to define the preemption model on the kernel 1217b419f47SPeter Zijlstra command line parameter and thus override the default preemption 1227b419f47SPeter Zijlstra model defined during compile time. 1237b419f47SPeter Zijlstra 1247b419f47SPeter Zijlstra The feature is primarily interesting for Linux distributions which 1257b419f47SPeter Zijlstra provide a pre-built kernel binary to reduce the number of kernel 1267b419f47SPeter Zijlstra flavors they offer while still offering different usecases. 1277b419f47SPeter Zijlstra 1287b419f47SPeter Zijlstra The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled 1297b419f47SPeter Zijlstra but if runtime patching is not available for the specific architecture 1307b419f47SPeter Zijlstra then the potential overhead should be considered. 1317b419f47SPeter Zijlstra 132d2343cb8SIngo Molnar Interesting if you want the same pre-built kernel should be used for 133d2343cb8SIngo Molnar both Server and Desktop workloads. 134d2343cb8SIngo Molnar 1357b419f47SPeter Zijlstraconfig SCHED_CORE 136f0e1a064STejun Heo bool "Core Scheduling for SMT" 137f0e1a064STejun Heo depends on SCHED_SMT 138b5ba2e1aSAndrea Righi help 139*a2f4b16eSTejun Heo This option permits Core Scheduling, a means of coordinated task 140f0e1a064STejun Heo selection across SMT siblings. When enabled -- see 141f0e1a064STejun Heo prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings 142f0e1a064STejun Heo will execute a task from the same 'core group', forcing idle when no 143f0e1a064STejun Heo matching task is found. 1449edeaea1SPeter Zijlstra 145f0e1a064STejun Heo Use of this feature includes: 146f0e1a064STejun Heo - mitigation of some (not all) SMT side channels; 147f0e1a064STejun Heo - limiting SMT interference to improve determinism and/or performance. 148f0e1a064STejun Heo 149f0e1a064STejun Heo SCHED_CORE is default disabled. When it is enabled and unused, 150f0e1a064STejun Heo which is the likely usage by Linux distributions, there should 151f0e1a064STejun Heo be no measurable impact on performance. 152f0e1a064STejun Heo 153f0e1a064STejun Heoconfig SCHED_CLASS_EXT 154f0e1a064STejun Heo bool "Extensible Scheduling Class" 155f0e1a064STejun Heo depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF 156f0e1a064STejun Heo select STACKTRACE if STACKTRACE_SUPPORT 157f0e1a064STejun Heo help 158f0e1a064STejun Heo This option enables a new scheduler class sched_ext (SCX), which 159f0e1a064STejun Heo allows scheduling policies to be implemented as BPF programs to 160fa48e8d2STejun Heo achieve the following: 161f0e1a064STejun Heo 162 - Ease of experimentation and exploration: Enabling rapid 163 iteration of new scheduling policies. 164 - Customization: Building application-specific schedulers which 165 implement policies that are not applicable to general-purpose 166 schedulers. 167 - Rapid scheduler deployments: Non-disruptive swap outs of 168 scheduling policies in production environments. 169 170 sched_ext leverages BPF struct_ops feature to define a structure 171 which exports function callbacks and flags to BPF programs that 172 wish to implement scheduling policies. The struct_ops structure 173 exported by sched_ext is struct sched_ext_ops, and is conceptually 174 similar to struct sched_class. 175 176 For more information: 177 Documentation/scheduler/sched-ext.rst 178 https://github.com/sched-ext/scx 179