| 1 |
# SPDX-License-Identifier: GPL-2.0-only |
| 2 |
|
| 3 |
config PREEMPT_NONE_BUILD |
| 4 |
bool |
| 5 |
|
| 6 |
config PREEMPT_VOLUNTARY_BUILD |
| 7 |
bool |
| 8 |
|
| 9 |
config PREEMPT_BUILD |
| 10 |
bool |
| 11 |
select PREEMPTION |
| 12 |
select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK |
| 13 |
|
| 14 |
config ARCH_HAS_PREEMPT_LAZY |
| 15 |
bool |
| 16 |
|
| 17 |
choice |
| 18 |
prompt "Preemption Model" |
| 19 |
default PREEMPT_LAZY if ARCH_HAS_PREEMPT_LAZY |
| 20 |
default PREEMPT_NONE |
| 21 |
|
| 22 |
config 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 |
|
| 38 |
config 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 |
|
| 59 |
config 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 |
|
| 78 |
config 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 |
|
| 90 |
endchoice |
| 91 |
|
| 92 |
config 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 |
|
| 109 |
config 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 |
|
| 122 |
config PREEMPT_COUNT |
| 123 |
bool |
| 124 |
|
| 125 |
config PREEMPTION |
| 126 |
bool |
| 127 |
select PREEMPT_COUNT |
| 128 |
|
| 129 |
config PREEMPT_DYNAMIC |
| 130 |
bool "Preemption behaviour defined on boot" |
| 131 |
depends on HAVE_PREEMPT_DYNAMIC |
| 132 |
select JUMP_LABEL if HAVE_PREEMPT_DYNAMIC_KEY |
| 133 |
select PREEMPT_BUILD |
| 134 |
default y if HAVE_PREEMPT_DYNAMIC_CALL |
| 135 |
help |
| 136 |
This option allows to define the preemption model on the kernel |
| 137 |
command line parameter and thus override the default preemption |
| 138 |
model defined during compile time. |
| 139 |
|
| 140 |
The feature is primarily interesting for Linux distributions which |
| 141 |
provide a pre-built kernel binary to reduce the number of kernel |
| 142 |
flavors they offer while still offering different usecases. |
| 143 |
|
| 144 |
The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled |
| 145 |
but if runtime patching is not available for the specific architecture |
| 146 |
then the potential overhead should be considered. |
| 147 |
|
| 148 |
Interesting if you want the same pre-built kernel should be used for |
| 149 |
both Server and Desktop workloads. |
| 150 |
|
| 151 |
config SCHED_CORE |
| 152 |
bool "Core Scheduling for SMT" |
| 153 |
depends on SCHED_SMT |
| 154 |
help |
| 155 |
This option permits Core Scheduling, a means of coordinated task |
| 156 |
selection across SMT siblings. When enabled -- see |
| 157 |
prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings |
| 158 |
will execute a task from the same 'core group', forcing idle when no |
| 159 |
matching task is found. |
| 160 |
|
| 161 |
Use of this feature includes: |
| 162 |
- mitigation of some (not all) SMT side channels; |
| 163 |
- limiting SMT interference to improve determinism and/or performance. |
| 164 |
|
| 165 |
SCHED_CORE is default disabled. When it is enabled and unused, |
| 166 |
which is the likely usage by Linux distributions, there should |
| 167 |
be no measurable impact on performance. |
| 168 |
|
| 169 |
config SCHED_CLASS_EXT |
| 170 |
bool "Extensible Scheduling Class" |
| 171 |
depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF |
| 172 |
select STACKTRACE if STACKTRACE_SUPPORT |
| 173 |
help |
| 174 |
This option enables a new scheduler class sched_ext (SCX), which |
| 175 |
allows scheduling policies to be implemented as BPF programs to |
| 176 |
achieve the following: |
| 177 |
|
| 178 |
- Ease of experimentation and exploration: Enabling rapid |
| 179 |
iteration of new scheduling policies. |
| 180 |
- Customization: Building application-specific schedulers which |
| 181 |
implement policies that are not applicable to general-purpose |
| 182 |
schedulers. |
| 183 |
- Rapid scheduler deployments: Non-disruptive swap outs of |
| 184 |
scheduling policies in production environments. |
| 185 |
|
| 186 |
sched_ext leverages BPF struct_ops feature to define a structure |
| 187 |
which exports function callbacks and flags to BPF programs that |
| 188 |
wish to implement scheduling policies. The struct_ops structure |
| 189 |
exported by sched_ext is struct sched_ext_ops, and is conceptually |
| 190 |
similar to struct sched_class. |
| 191 |
|
| 192 |
For more information: |
| 193 |
Documentation/scheduler/sched-ext.rst |
| 194 |
https://github.com/sched-ext/scx |