Re: [tip: sched/core] sched,x86: Allow !PREEMPT_DYNAMIC

From: Peter Zijlstra
Date: Tue Feb 16 2021 - 05:40:51 EST


On Wed, Feb 10, 2021 at 03:18:38PM +0100, Frederic Weisbecker wrote:
> Also should we add something like this?

I suppose we can do that, but I'd rather have actual numbers to go with
it, I don't think the trampolines are really that terrible.

> From: Frederic Weisbecker <frederic@xxxxxxxxxx>
> Date: Wed, 10 Feb 2021 15:11:39 +0100
> Subject: [PATCH] preempt/dynamic: Make PREEMPT_DYNAMIC optional
>
> In order not to make the small trampoline overhead mandatory for archs
> that support HAVE_STATIC_CALL but not HAVE_STATIC_CALL_INLINE, make
> PREEMPT_DYNAMIC optional.
>
> Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
> ---
> kernel/Kconfig.preempt | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
> index 416017301660..1fe759677907 100644
> --- a/kernel/Kconfig.preempt
> +++ b/kernel/Kconfig.preempt
> @@ -40,7 +40,6 @@ config PREEMPT
> depends on !ARCH_NO_PREEMPT
> select PREEMPTION
> select UNINLINE_SPIN_UNLOCK if !ARCH_INLINE_SPIN_UNLOCK
> - select PREEMPT_DYNAMIC if HAVE_PREEMPT_DYNAMIC
> help
> This option reduces the latency of the kernel by making
> all kernel code (that is not executing in a critical section)
> @@ -83,11 +82,13 @@ config PREEMPTION
> select PREEMPT_COUNT
>
> config PREEMPT_DYNAMIC
> - bool
> + bool "Override preemption flavour at boot time"
> + depends on HAVE_PREEMPT_DYNAMIC && PREEMPT
> + default HAVE_STATIC_CALL_INLINE
> 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.
> + command line parameter "preempt=" 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
> @@ -99,3 +100,5 @@ config PREEMPT_DYNAMIC
>
> Interesting if you want the same pre-built kernel should be used for
> both Server and Desktop workloads.
> +
> + Say Y if you have CONFIG_HAVE_STATIC_CALL_INLINE.
> --
> 2.25.1
>