xref: /linux/kernel/Kconfig.preempt (revision 99cf983cc8bca4adb461b519664c939a565cfd4d)
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 Molnarchoice
15f8cbd99bSIngo Molnar	prompt "Preemption Model"
16a8b76910SValentin Schneider	default PREEMPT_NONE
17f8cbd99bSIngo Molnar
18a8b76910SValentin Schneiderconfig PREEMPT_NONE
19f8cbd99bSIngo Molnar	bool "No Forced Preemption (Server)"
20a8b76910SValentin Schneider	select PREEMPT_NONE_BUILD if !PREEMPT_DYNAMIC
21cc19ca86SIngo Molnar	help
22f8cbd99bSIngo Molnar	  This is the traditional Linux preemption model, geared towards
23f8cbd99bSIngo Molnar	  throughput. It will still provide good latencies most of the
24f8cbd99bSIngo Molnar	  time, but there are no guarantees and occasional longer delays
25f8cbd99bSIngo Molnar	  are possible.
26f8cbd99bSIngo Molnar
27f8cbd99bSIngo Molnar	  Select this option if you are building a kernel for a server or
28f8cbd99bSIngo Molnar	  scientific/computation system, or if you want to maximize the
29f8cbd99bSIngo Molnar	  raw processing power of the kernel, irrespective of scheduling
30f8cbd99bSIngo Molnar	  latencies.
31f8cbd99bSIngo Molnar
32a8b76910SValentin Schneiderconfig PREEMPT_VOLUNTARY
33f8cbd99bSIngo Molnar	bool "Voluntary Kernel Preemption (Desktop)"
3487a4c375SChristoph Hellwig	depends on !ARCH_NO_PREEMPT
35a8b76910SValentin Schneider	select PREEMPT_VOLUNTARY_BUILD if !PREEMPT_DYNAMIC
36f8cbd99bSIngo Molnar	help
37f8cbd99bSIngo Molnar	  This option reduces the latency of the kernel by adding more
38f8cbd99bSIngo Molnar	  "explicit preemption points" to the kernel code. These new
39f8cbd99bSIngo Molnar	  preemption points have been selected to reduce the maximum
40f8cbd99bSIngo Molnar	  latency of rescheduling, providing faster application reactions,
413dde6ad8SDavid Sterba	  at the cost of slightly lower throughput.
42f8cbd99bSIngo Molnar
43f8cbd99bSIngo Molnar	  This allows reaction to interactive events by allowing a
44f8cbd99bSIngo Molnar	  low priority process to voluntarily preempt itself even if it
45f8cbd99bSIngo Molnar	  is in kernel mode executing a system call. This allows
46f8cbd99bSIngo Molnar	  applications to run more 'smoothly' even when the system is
47cc19ca86SIngo Molnar	  under load.
48cc19ca86SIngo Molnar
49f8cbd99bSIngo Molnar	  Select this if you are building a kernel for a desktop system.
50f8cbd99bSIngo Molnar
51a8b76910SValentin Schneiderconfig PREEMPT
52f8cbd99bSIngo Molnar	bool "Preemptible Kernel (Low-Latency Desktop)"
5387a4c375SChristoph Hellwig	depends on !ARCH_NO_PREEMPT
54a8b76910SValentin Schneider	select PREEMPT_BUILD
55f8cbd99bSIngo Molnar	help
56f8cbd99bSIngo Molnar	  This option reduces the latency of the kernel by making
57f8cbd99bSIngo Molnar	  all kernel code (that is not executing in a critical section)
58f8cbd99bSIngo Molnar	  preemptible.  This allows reaction to interactive events by
59f8cbd99bSIngo Molnar	  permitting a low priority process to be preempted involuntarily
60f8cbd99bSIngo Molnar	  even if it is in kernel mode executing a system call and would
61f8cbd99bSIngo Molnar	  otherwise not be about to reach a natural preemption point.
62f8cbd99bSIngo Molnar	  This allows applications to run more 'smoothly' even when the
633dde6ad8SDavid Sterba	  system is under load, at the cost of slightly lower throughput
64f8cbd99bSIngo Molnar	  and a slight runtime overhead to kernel code.
65f8cbd99bSIngo Molnar
66f8cbd99bSIngo Molnar	  Select this if you are building a kernel for a desktop or
67f8cbd99bSIngo Molnar	  embedded system with latency requirements in the milliseconds
68f8cbd99bSIngo Molnar	  range.
69f8cbd99bSIngo Molnar
70a50a3f4bSThomas Gleixnerconfig PREEMPT_RT
71a50a3f4bSThomas Gleixner	bool "Fully Preemptible Kernel (Real-Time)"
72a8b76910SValentin Schneider	depends on EXPERT && ARCH_SUPPORTS_RT
73b8d33498SThomas Gleixner	select PREEMPTION
74a50a3f4bSThomas Gleixner	help
75a50a3f4bSThomas Gleixner	  This option turns the kernel into a real-time kernel by replacing
76a50a3f4bSThomas Gleixner	  various locking primitives (spinlocks, rwlocks, etc.) with
77a50a3f4bSThomas Gleixner	  preemptible priority-inheritance aware variants, enforcing
78a50a3f4bSThomas Gleixner	  interrupt threading and introducing mechanisms to break up long
79a50a3f4bSThomas Gleixner	  non-preemptible sections. This makes the kernel, except for very
80d61ca3c2SSrivatsa S. Bhat (VMware)	  low level and critical code paths (entry code, scheduler, low
81a50a3f4bSThomas Gleixner	  level interrupt handling) fully preemptible and brings most
82a50a3f4bSThomas Gleixner	  execution contexts under scheduler control.
83a50a3f4bSThomas Gleixner
84a50a3f4bSThomas Gleixner	  Select this if you are building a kernel for systems which
85a50a3f4bSThomas Gleixner	  require real-time guarantees.
86a50a3f4bSThomas Gleixner
87f8cbd99bSIngo Molnarendchoice
88cc19ca86SIngo Molnar
89bdd4e85dSFrederic Weisbeckerconfig PREEMPT_COUNT
90bdd4e85dSFrederic Weisbecker       bool
91a50a3f4bSThomas Gleixner
92b8d33498SThomas Gleixnerconfig PREEMPTION
93a50a3f4bSThomas Gleixner       bool
94a50a3f4bSThomas Gleixner       select PREEMPT_COUNT
956ef869e0SMichal Hocko
966ef869e0SMichal Hockoconfig PREEMPT_DYNAMIC
97c597bfddSFrederic Weisbecker	bool "Preemption behaviour defined on boot"
98a8b76910SValentin Schneider	depends on HAVE_PREEMPT_DYNAMIC && !PREEMPT_RT
99*99cf983cSMark Rutland	select JUMP_LABEL if HAVE_PREEMPT_DYNAMIC_KEY
100a8b76910SValentin Schneider	select PREEMPT_BUILD
101*99cf983cSMark Rutland	default y if HAVE_PREEMPT_DYNAMIC_CALL
1026ef869e0SMichal Hocko	help
1036ef869e0SMichal Hocko	  This option allows to define the preemption model on the kernel
1046ef869e0SMichal Hocko	  command line parameter and thus override the default preemption
1056ef869e0SMichal Hocko	  model defined during compile time.
1066ef869e0SMichal Hocko
1076ef869e0SMichal Hocko	  The feature is primarily interesting for Linux distributions which
1086ef869e0SMichal Hocko	  provide a pre-built kernel binary to reduce the number of kernel
1096ef869e0SMichal Hocko	  flavors they offer while still offering different usecases.
1106ef869e0SMichal Hocko
1116ef869e0SMichal Hocko	  The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled
1126ef869e0SMichal Hocko	  but if runtime patching is not available for the specific architecture
1136ef869e0SMichal Hocko	  then the potential overhead should be considered.
1146ef869e0SMichal Hocko
1156ef869e0SMichal Hocko	  Interesting if you want the same pre-built kernel should be used for
1166ef869e0SMichal Hocko	  both Server and Desktop workloads.
1179edeaea1SPeter Zijlstra
1189edeaea1SPeter Zijlstraconfig SCHED_CORE
1199edeaea1SPeter Zijlstra	bool "Core Scheduling for SMT"
1209edeaea1SPeter Zijlstra	depends on SCHED_SMT
1217b419f47SPeter Zijlstra	help
1227b419f47SPeter Zijlstra	  This option permits Core Scheduling, a means of coordinated task
1237b419f47SPeter Zijlstra	  selection across SMT siblings. When enabled -- see
1247b419f47SPeter Zijlstra	  prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings
1257b419f47SPeter Zijlstra	  will execute a task from the same 'core group', forcing idle when no
1267b419f47SPeter Zijlstra	  matching task is found.
1277b419f47SPeter Zijlstra
1287b419f47SPeter Zijlstra	  Use of this feature includes:
1297b419f47SPeter Zijlstra	   - mitigation of some (not all) SMT side channels;
1307b419f47SPeter Zijlstra	   - limiting SMT interference to improve determinism and/or performance.
1317b419f47SPeter Zijlstra
132d2343cb8SIngo Molnar	  SCHED_CORE is default disabled. When it is enabled and unused,
133d2343cb8SIngo Molnar	  which is the likely usage by Linux distributions, there should
134d2343cb8SIngo Molnar	  be no measurable impact on performance.
1357b419f47SPeter Zijlstra
1369edeaea1SPeter Zijlstra
137