1 ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2 cc19ca86SIngo Molnar 3 f8cbd99bSIngo Molnarchoice 4 f8cbd99bSIngo Molnar prompt "Preemption Model" 5 f8cbd99bSIngo Molnar default PREEMPT_NONE 6 f8cbd99bSIngo Molnar 7 f8cbd99bSIngo Molnarconfig PREEMPT_NONE 8 f8cbd99bSIngo Molnar bool "No Forced Preemption (Server)" 9 cc19ca86SIngo Molnar help 10 f8cbd99bSIngo Molnar This is the traditional Linux preemption model, geared towards 11 f8cbd99bSIngo Molnar throughput. It will still provide good latencies most of the 12 f8cbd99bSIngo Molnar time, but there are no guarantees and occasional longer delays 13 f8cbd99bSIngo Molnar are possible. 14 f8cbd99bSIngo Molnar 15 f8cbd99bSIngo Molnar Select this option if you are building a kernel for a server or 16 f8cbd99bSIngo Molnar scientific/computation system, or if you want to maximize the 17 f8cbd99bSIngo Molnar raw processing power of the kernel, irrespective of scheduling 18 f8cbd99bSIngo Molnar latencies. 19 f8cbd99bSIngo Molnar 20 f8cbd99bSIngo Molnarconfig PREEMPT_VOLUNTARY 21 f8cbd99bSIngo Molnar bool "Voluntary Kernel Preemption (Desktop)" 22 87a4c375SChristoph Hellwig depends on !ARCH_NO_PREEMPT 23 f8cbd99bSIngo Molnar help 24 f8cbd99bSIngo Molnar This option reduces the latency of the kernel by adding more 25 f8cbd99bSIngo Molnar "explicit preemption points" to the kernel code. These new 26 f8cbd99bSIngo Molnar preemption points have been selected to reduce the maximum 27 f8cbd99bSIngo Molnar latency of rescheduling, providing faster application reactions, 28 3dde6ad8SDavid Sterba at the cost of slightly lower throughput. 29 f8cbd99bSIngo Molnar 30 f8cbd99bSIngo Molnar This allows reaction to interactive events by allowing a 31 f8cbd99bSIngo Molnar low priority process to voluntarily preempt itself even if it 32 f8cbd99bSIngo Molnar is in kernel mode executing a system call. This allows 33 f8cbd99bSIngo Molnar applications to run more 'smoothly' even when the system is 34 cc19ca86SIngo Molnar under load. 35 cc19ca86SIngo Molnar 36 f8cbd99bSIngo Molnar Select this if you are building a kernel for a desktop system. 37 f8cbd99bSIngo Molnar 38 b8d33498SThomas Gleixnerconfig PREEMPT 39 f8cbd99bSIngo Molnar bool "Preemptible Kernel (Low-Latency Desktop)" 40 87a4c375SChristoph Hellwig depends on !ARCH_NO_PREEMPT 41 b8d33498SThomas Gleixner select PREEMPTION 42 e335e3ebSRaghavendra K T select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK 43 6ef869e0SMichal Hocko select PREEMPT_DYNAMIC if HAVE_PREEMPT_DYNAMIC 44 f8cbd99bSIngo Molnar help 45 f8cbd99bSIngo Molnar This option reduces the latency of the kernel by making 46 f8cbd99bSIngo Molnar all kernel code (that is not executing in a critical section) 47 f8cbd99bSIngo Molnar preemptible. This allows reaction to interactive events by 48 f8cbd99bSIngo Molnar permitting a low priority process to be preempted involuntarily 49 f8cbd99bSIngo Molnar even if it is in kernel mode executing a system call and would 50 f8cbd99bSIngo Molnar otherwise not be about to reach a natural preemption point. 51 f8cbd99bSIngo Molnar This allows applications to run more 'smoothly' even when the 52 3dde6ad8SDavid Sterba system is under load, at the cost of slightly lower throughput 53 f8cbd99bSIngo Molnar and a slight runtime overhead to kernel code. 54 f8cbd99bSIngo Molnar 55 f8cbd99bSIngo Molnar Select this if you are building a kernel for a desktop or 56 f8cbd99bSIngo Molnar embedded system with latency requirements in the milliseconds 57 f8cbd99bSIngo Molnar range. 58 f8cbd99bSIngo Molnar 59 a50a3f4bSThomas Gleixnerconfig PREEMPT_RT 60 a50a3f4bSThomas Gleixner bool "Fully Preemptible Kernel (Real-Time)" 61 a50a3f4bSThomas Gleixner depends on EXPERT && ARCH_SUPPORTS_RT 62 b8d33498SThomas Gleixner select PREEMPTION 63 a50a3f4bSThomas Gleixner help 64 a50a3f4bSThomas Gleixner This option turns the kernel into a real-time kernel by replacing 65 a50a3f4bSThomas Gleixner various locking primitives (spinlocks, rwlocks, etc.) with 66 a50a3f4bSThomas Gleixner preemptible priority-inheritance aware variants, enforcing 67 a50a3f4bSThomas Gleixner interrupt threading and introducing mechanisms to break up long 68 a50a3f4bSThomas Gleixner non-preemptible sections. This makes the kernel, except for very 69 d61ca3c2SSrivatsa S. Bhat (VMware) low level and critical code paths (entry code, scheduler, low 70 a50a3f4bSThomas Gleixner level interrupt handling) fully preemptible and brings most 71 a50a3f4bSThomas Gleixner execution contexts under scheduler control. 72 a50a3f4bSThomas Gleixner 73 a50a3f4bSThomas Gleixner Select this if you are building a kernel for systems which 74 a50a3f4bSThomas Gleixner require real-time guarantees. 75 a50a3f4bSThomas Gleixner 76 f8cbd99bSIngo Molnarendchoice 77 cc19ca86SIngo Molnar 78 bdd4e85dSFrederic Weisbeckerconfig PREEMPT_COUNT 79 bdd4e85dSFrederic Weisbecker bool 80 a50a3f4bSThomas Gleixner 81 b8d33498SThomas Gleixnerconfig PREEMPTION 82 a50a3f4bSThomas Gleixner bool 83 a50a3f4bSThomas Gleixner select PREEMPT_COUNT 84 6ef869e0SMichal Hocko 85 6ef869e0SMichal Hockoconfig PREEMPT_DYNAMIC 86 6ef869e0SMichal Hocko bool 87 6ef869e0SMichal Hocko help 88 6ef869e0SMichal Hocko This option allows to define the preemption model on the kernel 89 6ef869e0SMichal Hocko command line parameter and thus override the default preemption 90 6ef869e0SMichal Hocko model defined during compile time. 91 6ef869e0SMichal Hocko 92 6ef869e0SMichal Hocko The feature is primarily interesting for Linux distributions which 93 6ef869e0SMichal Hocko provide a pre-built kernel binary to reduce the number of kernel 94 6ef869e0SMichal Hocko flavors they offer while still offering different usecases. 95 6ef869e0SMichal Hocko 96 6ef869e0SMichal Hocko The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled 97 6ef869e0SMichal Hocko but if runtime patching is not available for the specific architecture 98 6ef869e0SMichal Hocko then the potential overhead should be considered. 99 6ef869e0SMichal Hocko 100 6ef869e0SMichal Hocko Interesting if you want the same pre-built kernel should be used for 101 6ef869e0SMichal Hocko both Server and Desktop workloads. 102 9edeaea1SPeter Zijlstra 103 9edeaea1SPeter Zijlstraconfig SCHED_CORE 104 9edeaea1SPeter Zijlstra bool "Core Scheduling for SMT" 105 9edeaea1SPeter Zijlstra default y 106 9edeaea1SPeter Zijlstra depends on SCHED_SMT 107 *7b419f47SPeter Zijlstra help 108 *7b419f47SPeter Zijlstra This option permits Core Scheduling, a means of coordinated task 109 *7b419f47SPeter Zijlstra selection across SMT siblings. When enabled -- see 110 *7b419f47SPeter Zijlstra prctl(PR_SCHED_CORE) -- task selection ensures that all SMT siblings 111 *7b419f47SPeter Zijlstra will execute a task from the same 'core group', forcing idle when no 112 *7b419f47SPeter Zijlstra matching task is found. 113 *7b419f47SPeter Zijlstra 114 *7b419f47SPeter Zijlstra Use of this feature includes: 115 *7b419f47SPeter Zijlstra - mitigation of some (not all) SMT side channels; 116 *7b419f47SPeter Zijlstra - limiting SMT interference to improve determinism and/or performance. 117 *7b419f47SPeter Zijlstra 118 *7b419f47SPeter Zijlstra SCHED_CORE is default enabled when SCHED_SMT is enabled -- when 119 *7b419f47SPeter Zijlstra unused there should be no impact on performance. 120 *7b419f47SPeter Zijlstra 121 9edeaea1SPeter Zijlstra 122