Re: [PATCH] sched: Tweak default dynamic preempt mode selection
From: Mike Galbraith
Date: Tue Nov 09 2021 - 00:31:05 EST
On Mon, 2021-11-08 at 15:21 +0000, Valentin Schneider wrote:
> On 08/11/21 13:27, Mike Galbraith wrote:
> >
> > As long as RT depends on EXPERT it'll be a bit annoying regardless. I
> > just thought it worth mention that what you want now and what RT will
> > presumably want upon merge completion appear to be mutually exclusive.
> >
>
> Hmm actually I think your approach should work, i.e. have
>
> config PREEMPT_DYNAMIC
> depends on [...] && !PREEMPT_RT
>
> rather than
>
> config PREEMPT_RT
> depends on [...] && !PREEMPT_DYNAMIC
>
> This essentially gives priority to the preemption model type over the
> preemption model dynamicness, which I think makes sense. I can fold that in
> v2.
Not seeing your v2 land yet, I grabbed my mallet and had a go at goal
reconciliation over morning java. Non-lovely result seems to work.
sched, Kconfig: Fix preemption model selection
Switch PREEMPT_DYNAMIC/PREEMPT_RT dependency around so PREEMPT_RT
can be selected during the initial preemption model selection.
Further, since PREEMPT_DYNAMIC requires PREEMPT, make it depend
upon it instead of selecting it, and add a menu to allow selection
of the boot time behavior, this to allow arches that do not support
PREEMPT_DYNAMIC to retain their various configs untouched.
Signed-off-by: Mike Galbraith <efault@xxxxxx>
---
kernel/Kconfig.preempt | 46 +++++++++++++++++++++++++---------------
------
1 file changed, 25 insertions(+), 21 deletions(-)
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -2,11 +2,10 @@
choice
prompt "Preemption Model"
- default PREEMPT_NONE_BEHAVIOUR
+ default PREEMPT_NONE
-config PREEMPT_NONE_BEHAVIOUR
+config PREEMPT_NONE
bool "No Forced Preemption (Server)"
- select PREEMPT_NONE if !PREEMPT_DYNAMIC
help
This is the traditional Linux preemption model, geared
towards
throughput. It will still provide good latencies most of the
@@ -18,10 +17,9 @@ config PREEMPT_NONE_BEHAVIOUR
raw processing power of the kernel, irrespective of
scheduling
latencies.
-config PREEMPT_VOLUNTARY_BEHAVIOUR
+config PREEMPT_VOLUNTARY
bool "Voluntary Kernel Preemption (Desktop)"
depends on !ARCH_NO_PREEMPT
- select PREEMPT_VOLUNTARY if !PREEMPT_DYNAMIC
help
This option reduces the latency of the kernel by adding more
"explicit preemption points" to the kernel code. These new
@@ -37,10 +35,11 @@ config PREEMPT_VOLUNTARY_BEHAVIOUR
Select this if you are building a kernel for a desktop
system.
-config PREEMPT_BEHAVIOUR
+config PREEMPT
bool "Preemptible Kernel (Low-Latency Desktop)"
depends on !ARCH_NO_PREEMPT
- select PREEMPT
+ select PREEMPTION
+ select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical
section)
@@ -58,7 +57,7 @@ config PREEMPT_BEHAVIOUR
config PREEMPT_RT
bool "Fully Preemptible Kernel (Real-Time)"
- depends on EXPERT && ARCH_SUPPORTS_RT && !PREEMPT_DYNAMIC
+ depends on EXPERT && ARCH_SUPPORTS_RT
select PREEMPTION
help
This option turns the kernel into a real-time kernel by
replacing
@@ -75,17 +74,6 @@ config PREEMPT_RT
endchoice
-config PREEMPT_NONE
- bool
-
-config PREEMPT_VOLUNTARY
- bool
-
-config PREEMPT
- bool
- select PREEMPTION
- select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
-
config PREEMPT_COUNT
bool
@@ -95,8 +83,7 @@ config PREEMPTION
config PREEMPT_DYNAMIC
bool "Preemption behaviour defined on boot"
- depends on HAVE_PREEMPT_DYNAMIC
- select PREEMPT
+ depends on HAVE_PREEMPT_DYNAMIC && PREEMPT
default y
help
This option allows to define the preemption model on the
kernel
@@ -114,6 +101,23 @@ config PREEMPT_DYNAMIC
Interesting if you want the same pre-built kernel should be
used for
both Server and Desktop workloads.
+if PREEMPT_DYNAMIC
+choice
+ prompt "Boot Time Preemption Model"
+ default PREEMPT_NONE_BEHAVIOR
+
+config PREEMPT_NONE_BEHAVIOR
+ bool "No Forced Preemption (Server)"
+
+config PREEMPT_VOLUNTARY_BEHAVIOR
+ bool "Voluntary Kernel Preemption (Desktop)"
+
+config PREEMPT_BEHAVIOR
+ bool "Preemptible Kernel (Low-Latency Desktop)"
+
+endchoice
+endif # PREEMPT_DYNAMIC
+
config SCHED_CORE
bool "Core Scheduling for SMT"
depends on SCHED_SMT