Re: [PATCH v2 5/6] sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}

From: Mark Rutland

Date: Tue Sep 01 2026 - 11:43:02 EST


On Fri, Aug 07, 2026 at 09:54:13AM +0800, Jinjie Ruan wrote:
>
>
> 在 2026/8/4 3:17, Mark Rutland 写道:
> > PREEMPT_DYNAMIC is now limited to the FULL and LAZY preemption models.
> > Switching model only changes the behaviour of dynamic_preempt_lazy(),
> > which uses a static key. There are no other static calls or static keys,
> > and so there's no need for HAVE_PREEMPT_DYNAMIC_CALL or
> > HAVE_PREEMPT_DYNAMIC_KEY.
> >
> > The static key used by dynamic_preempt_lazy() is entirely local to
> > kernel/sched/core.c, and any architecture which selects
> > ARCH_HAS_PREEMPT_LAZY implements the necessary support. Remove
> > PREEMPT_DYNAMIC's dependencies on HAVE_PREEMPT_DYNAMIC_CALL and
> > HAVE_PREEMPT_DYNAMIC_KEY entirely, leaving the dependency on
> > ARCH_HAS_PREEMPT_LAZY.
> >
> > For architectures which previously selected HAVE_PREEMPT_DYNAMIC_KEY,
> > PREEMPT_DYNAMIC will now be selected by default, matching x86. As the
> > runtime impact is limited to dynamic_preempt_lazy(), this shouldn't be
> > as concerning as previously (e.g. where calls to {cond,might}_resched()
> > stubs could introduce a measurable penalty).
> >
> > As all of this can work without jump labels, JUMP_LABEL is not selected
> > explicitly. It is obviously preferable to have JUMP_LABEL enabled, but
> > this is not functionally necessary.

[...]

> > diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
> > index fb49424003b2b..87d567680bc74 100644
> > --- a/kernel/Kconfig.preempt
> > +++ b/kernel/Kconfig.preempt
> > @@ -128,11 +128,9 @@ config PREEMPTION
> >
> > config PREEMPT_DYNAMIC
> > bool "Preemption behaviour defined on boot"
> > - depends on HAVE_PREEMPT_DYNAMIC
> > depends on ARCH_HAS_PREEMPT_LAZY
> > - select JUMP_LABEL if HAVE_PREEMPT_DYNAMIC_KEY
>
> After this, only the arm64 architecture explicitly selects JUMP_LABEL.
> When we remove the dependency on HAVE_PREEMPT_DYNAMIC_KEY, should we
> also select JUMP_LABEL for those architectures.
>
> git grep "select JUMP_LABEL"
> arch/arm64/Kconfig: select JUMP_LABEL
> block/Kconfig: select JUMP_LABEL if HAVE_ARCH_JUMP_LABEL
> fs/xfs/Kconfig: select JUMP_LABEL if HAVE_ARCH_JUMP_LABEL
> fs/xfs/Kconfig: select JUMP_LABEL if HAVE_ARCH_JUMP_LABEL

I had deliberately avoided selecting JUMP_LABEL. As the commit message
says, it's not functionally necessary. It also wasn't previously
selected for !HAVE_PREEMPT_DYNAMIC_KEY (e.g. on x86). The relevant
defconfig files have CONFIG_JUMP_LABEL=y regardless, so it ends up being
on by default in practice.

Not selecting JUMP_LABEL allows it to be turned off for testing, so I
would prefer to leave it as-is.

> otherwise
> Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>

Thanks!

Mark.