mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Mike Galbraith <efault@gmx.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: [PATCH] sched: Split preemption model selection between DYNAMIC & !DYNAMIC
Date: Tue,  9 Nov 2021 15:10:57 +0000	[thread overview]
Message-ID: <20211109151057.3489223-1-valentin.schneider@arm.com> (raw)

From: Mike Galbraith <efault@gmx.de>

Commit c597bfddc9e9 ("sched: Provide Kconfig support for default dynamic
preempt mode") changed the selectable config names for the preemption
model. This means a config file must now select

  CONFIG_PREEMPT_BEHAVIOUR=y

rather than

  CONFIG_PREEMPT=y

to get a preemptible kernel. This means all arch config files would need to
be updated - right now they'll all end up with the default
CONFIG_PREEMPT_NONE_BEHAVIOUR.

Rather than touch a good hundred of config files, split the preemption
model selection based on PREEMPT_DYNAMIC. !PREEMPT_DYNAMIC reverts to the
old behaviour with CONFIG_PREEMPT & friends being the user-visible config,
while PREEMPT_DYNAMIC exposes the _BEHAVIOUR counterparts.

Signed-off-by: Mike Galbraith <efault@gmx.de>
[Changelog; deduplicated some config logic]
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 kernel/Kconfig.preempt | 80 +++++++++++++++++++++++-------------------
 1 file changed, 43 insertions(+), 37 deletions(-)

diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index 60f1bfc3c7b2..4e60afae248e 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -1,12 +1,32 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+config PREEMPT_DYNAMIC
+	bool "Preemption behaviour defined on boot"
+	depends on HAVE_PREEMPT_DYNAMIC && !ARCH_NO_PREEMPT
+	select PREEMPT
+	help
+	  This option allows to define the preemption model on the kernel
+	  command line parameter and thus override the default preemption
+	  model defined during compile time.
+
+	  The feature is primarily interesting for Linux distributions which
+	  provide a pre-built kernel binary to reduce the number of kernel
+	  flavors they offer while still offering different usecases.
+
+	  The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled
+	  but if runtime patching is not available for the specific architecture
+	  then the potential overhead should be considered.
+
+	  Interesting if you want the same pre-built kernel should be used for
+	  both Server and Desktop workloads.
+
 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
+	depends on !PREEMPT_DYNAMIC
 	help
 	  This is the traditional Linux preemption model, geared towards
 	  throughput. It will still provide good latencies most of the
@@ -18,10 +38,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
+	depends on !ARCH_NO_PREEMPT && !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 +56,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)
@@ -75,16 +95,23 @@ config PREEMPT_RT
 
 endchoice
 
-config PREEMPT_NONE
-	bool
+choice
+	prompt "Default boot-time Preemption Model"
+	depends on PREEMPT_DYNAMIC
+	default PREEMPT_NONE_BEHAVIOUR
+	help
+	  This option defines the default preemption model of the kernel
+	  if it hasn't been specified by the "preempt=" command line parameter.
 
-config PREEMPT_VOLUNTARY
-	bool
+config PREEMPT_NONE_BEHAVIOUR
+	bool "No Forced Preemption (Server)"
 
-config PREEMPT
-	bool
-	select PREEMPTION
-	select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
+config PREEMPT_VOLUNTARY_BEHAVIOUR
+	bool "Voluntary Kernel Preemption (Desktop)"
+
+config PREEMPT_BEHAVIOUR
+	bool "Preemptible Kernel (Low-Latency Desktop)"
+endchoice
 
 config PREEMPT_COUNT
        bool
@@ -93,27 +120,6 @@ config PREEMPTION
        bool
        select PREEMPT_COUNT
 
-config PREEMPT_DYNAMIC
-	bool "Preemption behaviour defined on boot"
-	depends on HAVE_PREEMPT_DYNAMIC
-	select PREEMPT
-	default y
-	help
-	  This option allows to define the preemption model on the kernel
-	  command line parameter and thus override the default preemption
-	  model defined during compile time.
-
-	  The feature is primarily interesting for Linux distributions which
-	  provide a pre-built kernel binary to reduce the number of kernel
-	  flavors they offer while still offering different usecases.
-
-	  The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled
-	  but if runtime patching is not available for the specific architecture
-	  then the potential overhead should be considered.
-
-	  Interesting if you want the same pre-built kernel should be used for
-	  both Server and Desktop workloads.
-
 config SCHED_CORE
 	bool "Core Scheduling for SMT"
 	depends on SCHED_SMT
-- 
2.25.1


             reply	other threads:[~2021-11-09 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 15:10 Valentin Schneider [this message]
2021-11-10  1:17 ` Frederic Weisbecker
2021-11-10  4:37   ` Mike Galbraith
2021-11-10 11:24     ` Valentin Schneider
2021-11-10 14:45       ` Valentin Schneider
2021-11-10 15:03         ` Marco Elver
2021-11-10 15:16           ` Marco Elver
2021-11-10 16:49         ` Frederic Weisbecker
2021-11-10 16:56         ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211109151057.3489223-1-valentin.schneider@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=efault@gmx.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®