Thomas Gleixner | ec8f24b | 2019-05-19 13:07:45 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0-only |
Ingo Molnar | cc19ca8 | 2005-06-25 14:57:36 -0700 | [diff] [blame] | 2 | |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 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 | |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 14 | choice |
| 15 | prompt "Preemption Model" |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 16 | default PREEMPT_NONE |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 17 | |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 18 | config PREEMPT_NONE |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 19 | bool "No Forced Preemption (Server)" |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 20 | select PREEMPT_NONE_BUILD if !PREEMPT_DYNAMIC |
Ingo Molnar | cc19ca8 | 2005-06-25 14:57:36 -0700 | [diff] [blame] | 21 | help |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 22 | This is the traditional Linux preemption model, geared towards |
| 23 | throughput. It will still provide good latencies most of the |
| 24 | time, but there are no guarantees and occasional longer delays |
| 25 | are possible. |
| 26 | |
| 27 | Select this option if you are building a kernel for a server or |
| 28 | scientific/computation system, or if you want to maximize the |
| 29 | raw processing power of the kernel, irrespective of scheduling |
| 30 | latencies. |
| 31 | |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 32 | config PREEMPT_VOLUNTARY |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 33 | bool "Voluntary Kernel Preemption (Desktop)" |
Christoph Hellwig | 87a4c37 | 2018-07-31 13:39:32 +0200 | [diff] [blame] | 34 | depends on !ARCH_NO_PREEMPT |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 35 | select PREEMPT_VOLUNTARY_BUILD if !PREEMPT_DYNAMIC |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 36 | help |
| 37 | This option reduces the latency of the kernel by adding more |
| 38 | "explicit preemption points" to the kernel code. These new |
| 39 | preemption points have been selected to reduce the maximum |
| 40 | latency of rescheduling, providing faster application reactions, |
David Sterba | 3dde6ad | 2007-05-09 07:12:20 +0200 | [diff] [blame] | 41 | at the cost of slightly lower throughput. |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 42 | |
| 43 | This allows reaction to interactive events by allowing a |
| 44 | low priority process to voluntarily preempt itself even if it |
| 45 | is in kernel mode executing a system call. This allows |
| 46 | applications to run more 'smoothly' even when the system is |
Ingo Molnar | cc19ca8 | 2005-06-25 14:57:36 -0700 | [diff] [blame] | 47 | under load. |
| 48 | |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 49 | Select this if you are building a kernel for a desktop system. |
| 50 | |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 51 | config PREEMPT |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 52 | bool "Preemptible Kernel (Low-Latency Desktop)" |
Christoph Hellwig | 87a4c37 | 2018-07-31 13:39:32 +0200 | [diff] [blame] | 53 | depends on !ARCH_NO_PREEMPT |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 54 | select PREEMPT_BUILD |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 55 | help |
| 56 | This option reduces the latency of the kernel by making |
| 57 | all kernel code (that is not executing in a critical section) |
| 58 | preemptible. This allows reaction to interactive events by |
| 59 | permitting a low priority process to be preempted involuntarily |
| 60 | even if it is in kernel mode executing a system call and would |
| 61 | otherwise not be about to reach a natural preemption point. |
| 62 | This allows applications to run more 'smoothly' even when the |
David Sterba | 3dde6ad | 2007-05-09 07:12:20 +0200 | [diff] [blame] | 63 | system is under load, at the cost of slightly lower throughput |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 64 | and a slight runtime overhead to kernel code. |
| 65 | |
| 66 | Select this if you are building a kernel for a desktop or |
| 67 | embedded system with latency requirements in the milliseconds |
| 68 | range. |
| 69 | |
Thomas Gleixner | a50a3f4 | 2019-07-17 22:01:49 +0200 | [diff] [blame] | 70 | config PREEMPT_RT |
| 71 | bool "Fully Preemptible Kernel (Real-Time)" |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 72 | depends on EXPERT && ARCH_SUPPORTS_RT |
Thomas Gleixner | b8d3349 | 2019-07-22 17:59:19 +0200 | [diff] [blame] | 73 | select PREEMPTION |
Thomas Gleixner | a50a3f4 | 2019-07-17 22:01:49 +0200 | [diff] [blame] | 74 | help |
| 75 | This option turns the kernel into a real-time kernel by replacing |
| 76 | various locking primitives (spinlocks, rwlocks, etc.) with |
| 77 | preemptible priority-inheritance aware variants, enforcing |
| 78 | interrupt threading and introducing mechanisms to break up long |
| 79 | non-preemptible sections. This makes the kernel, except for very |
Srivatsa S. Bhat (VMware) | d61ca3c | 2019-10-25 16:02:07 -0700 | [diff] [blame] | 80 | low level and critical code paths (entry code, scheduler, low |
Thomas Gleixner | a50a3f4 | 2019-07-17 22:01:49 +0200 | [diff] [blame] | 81 | level interrupt handling) fully preemptible and brings most |
| 82 | execution contexts under scheduler control. |
| 83 | |
| 84 | Select this if you are building a kernel for systems which |
| 85 | require real-time guarantees. |
| 86 | |
Ingo Molnar | f8cbd99 | 2005-06-25 14:57:39 -0700 | [diff] [blame] | 87 | endchoice |
Ingo Molnar | cc19ca8 | 2005-06-25 14:57:36 -0700 | [diff] [blame] | 88 | |
Frederic Weisbecker | bdd4e85 | 2011-06-08 01:13:27 +0200 | [diff] [blame] | 89 | config PREEMPT_COUNT |
Masahiro Yamada | 7236793 | 2018-12-11 20:00:51 +0900 | [diff] [blame] | 90 | bool |
Thomas Gleixner | a50a3f4 | 2019-07-17 22:01:49 +0200 | [diff] [blame] | 91 | |
Thomas Gleixner | b8d3349 | 2019-07-22 17:59:19 +0200 | [diff] [blame] | 92 | config PREEMPTION |
Thomas Gleixner | a50a3f4 | 2019-07-17 22:01:49 +0200 | [diff] [blame] | 93 | bool |
| 94 | select PREEMPT_COUNT |
Michal Hocko | 6ef869e | 2021-01-18 15:12:19 +0100 | [diff] [blame] | 95 | |
| 96 | config PREEMPT_DYNAMIC |
Frederic Weisbecker | c597bfd | 2021-09-14 12:31:34 +0200 | [diff] [blame] | 97 | bool "Preemption behaviour defined on boot" |
Valentin Schneider | a8b7691 | 2021-11-10 20:24:44 +0000 | [diff] [blame] | 98 | depends on HAVE_PREEMPT_DYNAMIC && !PREEMPT_RT |
| 99 | select PREEMPT_BUILD |
Frederic Weisbecker | c597bfd | 2021-09-14 12:31:34 +0200 | [diff] [blame] | 100 | default y |
Michal Hocko | 6ef869e | 2021-01-18 15:12:19 +0100 | [diff] [blame] | 101 | help |
| 102 | This option allows to define the preemption model on the kernel |
| 103 | command line parameter and thus override the default preemption |
| 104 | model defined during compile time. |
| 105 | |
| 106 | The feature is primarily interesting for Linux distributions which |
| 107 | provide a pre-built kernel binary to reduce the number of kernel |
| 108 | flavors they offer while still offering different usecases. |
| 109 | |
| 110 | The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled |
| 111 | but if runtime patching is not available for the specific architecture |
| 112 | then the potential overhead should be considered. |
| 113 | |
| 114 | Interesting if you want the same pre-built kernel should be used for |
| 115 | both Server and Desktop workloads. |
Peter Zijlstra | 9edeaea | 2020-11-17 18:19:34 -0500 | [diff] [blame] | 116 | |
| 117 | config SCHED_CORE |
| 118 | bool "Core Scheduling for SMT" |
Peter Zijlstra | 9edeaea | 2020-11-17 18:19:34 -0500 | [diff] [blame] | 119 | depends on SCHED_SMT |
Peter Zijlstra | 7b419f4 | 2021-05-25 08:53:28 +0200 | [diff] [blame] | 120 | help |
| 121 | This option permits Core Scheduling, a means of coordinated task |
| 122 | selection across SMT siblings. When enabled -- see |
| 123 | prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings |
| 124 | will execute a task from the same 'core group', forcing idle when no |
| 125 | matching task is found. |
| 126 | |
| 127 | Use of this feature includes: |
| 128 | - mitigation of some (not all) SMT side channels; |
| 129 | - limiting SMT interference to improve determinism and/or performance. |
| 130 | |
Ingo Molnar | d2343cb | 2021-06-28 21:55:16 +0200 | [diff] [blame] | 131 | SCHED_CORE is default disabled. When it is enabled and unused, |
| 132 | which is the likely usage by Linux distributions, there should |
| 133 | be no measurable impact on performance. |
Peter Zijlstra | 7b419f4 | 2021-05-25 08:53:28 +0200 | [diff] [blame] | 134 | |
Peter Zijlstra | 9edeaea | 2020-11-17 18:19:34 -0500 | [diff] [blame] | 135 | |