arch/Kconfig | 38 ------- arch/arm64/Kconfig | 1 - arch/arm64/include/asm/preempt.h | 10 -- arch/loongarch/Kconfig | 1 - arch/powerpc/Kconfig | 1 - arch/riscv/Kconfig | 1 - arch/s390/Kconfig | 1 - arch/s390/include/asm/preempt.h | 11 -- arch/x86/Kconfig | 1 - arch/x86/include/asm/preempt.h | 28 ----- include/asm-generic/preempt.h | 10 -- include/linux/irq-entry-common.h | 17 +-- include/linux/kernel.h | 20 ---- include/linux/preempt.h | 20 ++-- include/linux/sched.h | 31 +----- kernel/Kconfig.preempt | 9 +- kernel/entry/common.c | 17 +-- kernel/sched/core.c | 180 +------------------------------ 18 files changed, 23 insertions(+), 374 deletions(-)
All architectures which currently suppoort PREEMPT_DYNAMIC select
ARCH_HAS_PREEMPT_LAZY. On architectures which select
ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
VOLUNTARY preemption models since v7.0 due to commit:
7dadeaa6e851 ("sched: Further restrict the preemption modes")
Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
VOLUNTARY preemption models.
This series makes the de-facto situation official by making
PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
code.
Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
commit:
a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
Given this is now late in the cycle, and given the tip:sched/core branch
is based on v7.2-rc1, I suspect tip folk might not want to queue this
now. Please let me know what you'd prefer; I'm happy to rebase and
resend after v7.3-rc1.
Since v1:
* Rebase to v7.2-rc4
* Apply Revied-by tags.
* Fix typos in commit messages.
* Add patch to cleanup accessors (per Shrikanth's comment)
Mark.
Mark Rutland (6):
sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY
sched: dynamic: Simplify {cond,might}_resched()
sched: dynamic: Simplify preempt_schedule{,_notrace}()
sched: dynamic: Simplify irqentry_exit_cond_resched()
sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}
sched: dynamic: Simplify preempt model accessors
arch/Kconfig | 38 -------
arch/arm64/Kconfig | 1 -
arch/arm64/include/asm/preempt.h | 10 --
arch/loongarch/Kconfig | 1 -
arch/powerpc/Kconfig | 1 -
arch/riscv/Kconfig | 1 -
arch/s390/Kconfig | 1 -
arch/s390/include/asm/preempt.h | 11 --
arch/x86/Kconfig | 1 -
arch/x86/include/asm/preempt.h | 28 -----
include/asm-generic/preempt.h | 10 --
include/linux/irq-entry-common.h | 17 +--
include/linux/kernel.h | 20 ----
include/linux/preempt.h | 20 ++--
include/linux/sched.h | 31 +-----
kernel/Kconfig.preempt | 9 +-
kernel/entry/common.c | 17 +--
kernel/sched/core.c | 180 +------------------------------
18 files changed, 23 insertions(+), 374 deletions(-)
--
2.30.2
在 2026/8/4 3:17, Mark Rutland 写道:
> All architectures which currently suppoort PREEMPT_DYNAMIC select
> ARCH_HAS_PREEMPT_LAZY. On architectures which select
> ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
> VOLUNTARY preemption models since v7.0 due to commit:
>
> 7dadeaa6e851 ("sched: Further restrict the preemption modes")
>
> Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
> VOLUNTARY preemption models.
>
> This series makes the de-facto situation official by making
> PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
> code.
>
> Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
> commit:
>
> a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
>
> Given this is now late in the cycle, and given the tip:sched/core branch
> is based on v7.2-rc1, I suspect tip folk might not want to queue this
> now. Please let me know what you'd prefer; I'm happy to rebase and
> resend after v7.3-rc1.
>
> Since v1:
> * Rebase to v7.2-rc4
> * Apply Revied-by tags.
> * Fix typos in commit messages.
> * Add patch to cleanup accessors (per Shrikanth's comment)
Hi Mark,
I did a test on v7.2-rc6 for arm64.
# ls -la Image_base Image_patch
-rw-r--r-- 1 root root 63158784 Aug 7 10:37 Image_base
-rw-r--r-- 1 root root 63093248 Aug 7 10:31 Image_patch
# ls -la vmlinux_base vmlinux_patch
-rwxr-xr-x 1 root root 206396648 Aug 7 10:37 vmlinux_base
-rwxr-xr-x 1 root root 206266232 Aug 7 10:31 vmlinux_patch
So the overall vmlinux file size reduced by ~127 KB and the Image
size reduced by ~64 KB.
Boot tested successfully with preempt=lazy and preempt=full on Qemu and
Kunpeng HIP09 server.
Boot with preempt=none and preempt=voluntary on Qemu.
Dynamic Preempt: unsupported mode: none
Dynamic Preempt: unsupported mode: voluntary
But runtime switching via /sys/kernel/debug/sched/preempt works not
right as below.
# echo full > preempt
# cat preempt
full lazy
# echo lazy > preempt
# cat preempt
full lazy
We should also update the "preempt_modes" array, after the below fix, it
shows ok;
# echo lazy > preempt
[ 37.407616] Dynamic Preempt: lazy
# cat preempt
full (lazy)
# echo full > preempt
[ 52.067001] Dynamic Preempt: full
# cat preempt
(full) lazy
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7899,7 +7899,7 @@ static inline void preempt_dynamic_init(void) { }
#endif /* CONFIG_PREEMPT_DYNAMIC */
const char *preempt_modes[] = {
- "none", "voluntary", "full", "lazy", NULL,
+ "full", "lazy", NULL,
};
Otherwise
Tested-by: Jinjie Ruan <ruanjinjie@huawei.com>
>
> Mark.
>
> Mark Rutland (6):
> sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY
> sched: dynamic: Simplify {cond,might}_resched()
> sched: dynamic: Simplify preempt_schedule{,_notrace}()
> sched: dynamic: Simplify irqentry_exit_cond_resched()
> sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}
> sched: dynamic: Simplify preempt model accessors
>
> arch/Kconfig | 38 -------
> arch/arm64/Kconfig | 1 -
> arch/arm64/include/asm/preempt.h | 10 --
> arch/loongarch/Kconfig | 1 -
> arch/powerpc/Kconfig | 1 -
> arch/riscv/Kconfig | 1 -
> arch/s390/Kconfig | 1 -
> arch/s390/include/asm/preempt.h | 11 --
> arch/x86/Kconfig | 1 -
> arch/x86/include/asm/preempt.h | 28 -----
> include/asm-generic/preempt.h | 10 --
> include/linux/irq-entry-common.h | 17 +--
> include/linux/kernel.h | 20 ----
> include/linux/preempt.h | 20 ++--
> include/linux/sched.h | 31 +-----
> kernel/Kconfig.preempt | 9 +-
> kernel/entry/common.c | 17 +--
> kernel/sched/core.c | 180 +------------------------------
> 18 files changed, 23 insertions(+), 374 deletions(-)
>
On Fri, Aug 07, 2026 at 11:33:05AM +0800, Jinjie Ruan wrote:
>
>
> 在 2026/8/4 3:17, Mark Rutland 写道:
> > All architectures which currently suppoort PREEMPT_DYNAMIC select
> > ARCH_HAS_PREEMPT_LAZY. On architectures which select
> > ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
> > VOLUNTARY preemption models since v7.0 due to commit:
> >
> > 7dadeaa6e851 ("sched: Further restrict the preemption modes")
> >
> > Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
> > VOLUNTARY preemption models.
> >
> > This series makes the de-facto situation official by making
> > PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
> > code.
> >
> > Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
> > commit:
> >
> > a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
> >
> > Given this is now late in the cycle, and given the tip:sched/core branch
> > is based on v7.2-rc1, I suspect tip folk might not want to queue this
> > now. Please let me know what you'd prefer; I'm happy to rebase and
> > resend after v7.3-rc1.
> >
> > Since v1:
> > * Rebase to v7.2-rc4
> > * Apply Revied-by tags.
> > * Fix typos in commit messages.
> > * Add patch to cleanup accessors (per Shrikanth's comment)
>
> Hi Mark,
>
> I did a test on v7.2-rc6 for arm64.
>
> # ls -la Image_base Image_patch
> -rw-r--r-- 1 root root 63158784 Aug 7 10:37 Image_base
> -rw-r--r-- 1 root root 63093248 Aug 7 10:31 Image_patch
> # ls -la vmlinux_base vmlinux_patch
> -rwxr-xr-x 1 root root 206396648 Aug 7 10:37 vmlinux_base
> -rwxr-xr-x 1 root root 206266232 Aug 7 10:31 vmlinux_patch
>
> So the overall vmlinux file size reduced by ~127 KB and the Image
> size reduced by ~64 KB.
>
> Boot tested successfully with preempt=lazy and preempt=full on Qemu and
> Kunpeng HIP09 server.
>
> Boot with preempt=none and preempt=voluntary on Qemu.
>
> Dynamic Preempt: unsupported mode: none
> Dynamic Preempt: unsupported mode: voluntary
>
> But runtime switching via /sys/kernel/debug/sched/preempt works not
> right as below.
>
> # echo full > preempt
> # cat preempt
> full lazy
> # echo lazy > preempt
> # cat preempt
> full lazy
>
> We should also update the "preempt_modes" array, after the below fix, it
> shows ok;
>
> # echo lazy > preempt
> [ 37.407616] Dynamic Preempt: lazy
> # cat preempt
> full (lazy)
> # echo full > preempt
> [ 52.067001] Dynamic Preempt: full
> # cat preempt
> (full) lazy
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7899,7 +7899,7 @@ static inline void preempt_dynamic_init(void) { }
> #endif /* CONFIG_PREEMPT_DYNAMIC */
>
> const char *preempt_modes[] = {
> - "none", "voluntary", "full", "lazy", NULL,
> + "full", "lazy", NULL,
> };
Ugh, yes.
We'll also need to fix up sched_dynamic_show(), since it has logic to
conditionally skip "none" and "voluntary".
This is all a bit messy, given the enum value isn't used to define the
string array. I'll see if I can figure a way to make that consistent by
construction, but that probably needs a bit more rework...
> Otherwise
> Tested-by: Jinjie Ruan <ruanjinjie@huawei.com>
Thanks!
Mark.
在 2026/8/4 3:17, Mark Rutland 写道:
> All architectures which currently suppoort PREEMPT_DYNAMIC select
> ARCH_HAS_PREEMPT_LAZY. On architectures which select
> ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
> VOLUNTARY preemption models since v7.0 due to commit:
>
> 7dadeaa6e851 ("sched: Further restrict the preemption modes")
>
> Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
> VOLUNTARY preemption models.
>
> This series makes the de-facto situation official by making
> PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
> code.
>
> Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
> commit:
>
> a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
>
> Given this is now late in the cycle, and given the tip:sched/core branch
> is based on v7.2-rc1, I suspect tip folk might not want to queue this
> now. Please let me know what you'd prefer; I'm happy to rebase and
> resend after v7.3-rc1.
>
> Since v1:
> * Rebase to v7.2-rc4
> * Apply Revied-by tags.
> * Fix typos in commit messages.
> * Add patch to cleanup accessors (per Shrikanth's comment)
>
> Mark.
>
> Mark Rutland (6):
> sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY
> sched: dynamic: Simplify {cond,might}_resched()
Hi Mark,
We also need to update the Doc.
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5410,8 +5410,6 @@ Kernel parameters
preempt= [KNL]
Select preemption mode if you have
CONFIG_PREEMPT_DYNAMIC
- none - Limited to cond_resched() calls
- voluntary - Limited to cond_resched() and
might_sleep() calls
full - Any section that isn't explicitly preempt
disabled
can be preempted anytime. Tasks will
also yield
contended spinlocks (if the critical
section isn't
Best regards,
Jinjie
> sched: dynamic: Simplify preempt_schedule{,_notrace}()
> sched: dynamic: Simplify irqentry_exit_cond_resched()
> sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}
> sched: dynamic: Simplify preempt model accessors
>
> arch/Kconfig | 38 -------
> arch/arm64/Kconfig | 1 -
> arch/arm64/include/asm/preempt.h | 10 --
> arch/loongarch/Kconfig | 1 -
> arch/powerpc/Kconfig | 1 -
> arch/riscv/Kconfig | 1 -
> arch/s390/Kconfig | 1 -
> arch/s390/include/asm/preempt.h | 11 --
> arch/x86/Kconfig | 1 -
> arch/x86/include/asm/preempt.h | 28 -----
> include/asm-generic/preempt.h | 10 --
> include/linux/irq-entry-common.h | 17 +--
> include/linux/kernel.h | 20 ----
> include/linux/preempt.h | 20 ++--
> include/linux/sched.h | 31 +-----
> kernel/Kconfig.preempt | 9 +-
> kernel/entry/common.c | 17 +--
> kernel/sched/core.c | 180 +------------------------------
> 18 files changed, 23 insertions(+), 374 deletions(-)
>
在 2026/8/7 11:11, Jinjie Ruan 写道:
>
>
> 在 2026/8/4 3:17, Mark Rutland 写道:
>> All architectures which currently suppoort PREEMPT_DYNAMIC select
>> ARCH_HAS_PREEMPT_LAZY. On architectures which select
>> ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
>> VOLUNTARY preemption models since v7.0 due to commit:
>>
>> 7dadeaa6e851 ("sched: Further restrict the preemption modes")
>>
>> Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
>> VOLUNTARY preemption models.
>>
>> This series makes the de-facto situation official by making
>> PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
>> code.
>>
>> Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
>> commit:
>>
>> a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
>>
>> Given this is now late in the cycle, and given the tip:sched/core branch
>> is based on v7.2-rc1, I suspect tip folk might not want to queue this
>> now. Please let me know what you'd prefer; I'm happy to rebase and
>> resend after v7.3-rc1.
>>
>> Since v1:
>> * Rebase to v7.2-rc4
>> * Apply Revied-by tags.
>> * Fix typos in commit messages.
>> * Add patch to cleanup accessors (per Shrikanth's comment)
>>
>> Mark.
>>
>> Mark Rutland (6):
>> sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY
>> sched: dynamic: Simplify {cond,might}_resched()
>
>
> Hi Mark,
>
> We also need to update the Doc.
>
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5410,8 +5410,6 @@ Kernel parameters
>
> preempt= [KNL]
> Select preemption mode if you have
> CONFIG_PREEMPT_DYNAMIC
> - none - Limited to cond_resched() calls
> - voluntary - Limited to cond_resched() and
> might_sleep() calls
> full - Any section that isn't explicitly preempt
> disabled
> can be preempted anytime. Tasks will
> also yield
> contended spinlocks (if the critical
Hi Mark,
What do you think?
> section isn't
>
> Best regards,
> Jinjie
>
>> sched: dynamic: Simplify preempt_schedule{,_notrace}()
>> sched: dynamic: Simplify irqentry_exit_cond_resched()
>> sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}
>> sched: dynamic: Simplify preempt model accessors
>>
>> arch/Kconfig | 38 -------
>> arch/arm64/Kconfig | 1 -
>> arch/arm64/include/asm/preempt.h | 10 --
>> arch/loongarch/Kconfig | 1 -
>> arch/powerpc/Kconfig | 1 -
>> arch/riscv/Kconfig | 1 -
>> arch/s390/Kconfig | 1 -
>> arch/s390/include/asm/preempt.h | 11 --
>> arch/x86/Kconfig | 1 -
>> arch/x86/include/asm/preempt.h | 28 -----
>> include/asm-generic/preempt.h | 10 --
>> include/linux/irq-entry-common.h | 17 +--
>> include/linux/kernel.h | 20 ----
>> include/linux/preempt.h | 20 ++--
>> include/linux/sched.h | 31 +-----
>> kernel/Kconfig.preempt | 9 +-
>> kernel/entry/common.c | 17 +--
>> kernel/sched/core.c | 180 +------------------------------
>> 18 files changed, 23 insertions(+), 374 deletions(-)
>>
>
On 8/4/26 12:47 AM, Mark Rutland wrote:
> All architectures which currently suppoort PREEMPT_DYNAMIC select
> ARCH_HAS_PREEMPT_LAZY. On architectures which select
> ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
> VOLUNTARY preemption models since v7.0 due to commit:
>
> 7dadeaa6e851 ("sched: Further restrict the preemption modes")
>
> Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
> VOLUNTARY preemption models.
>
> This series makes the de-facto situation official by making
> PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
> code.
>
> Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
> commit:
>
> a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
>
> Given this is now late in the cycle, and given the tip:sched/core branch
> is based on v7.2-rc1, I suspect tip folk might not want to queue this
> now. Please let me know what you'd prefer; I'm happy to rebase and
> resend after v7.3-rc1.
>
> Since v1:
> * Rebase to v7.2-rc4
> * Apply Revied-by tags.
> * Fix typos in commit messages.
> * Add patch to cleanup accessors (per Shrikanth's comment)
>
> Mark.
>
I have tested with and without PREEMPT_DYNAMIC for lazy/full.
I haven't observed anything odd.
For the series,
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Tested-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> Mark Rutland (6):
> sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY
> sched: dynamic: Simplify {cond,might}_resched()
> sched: dynamic: Simplify preempt_schedule{,_notrace}()
> sched: dynamic: Simplify irqentry_exit_cond_resched()
> sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY}
> sched: dynamic: Simplify preempt model accessors
>
> arch/Kconfig | 38 -------
> arch/arm64/Kconfig | 1 -
> arch/arm64/include/asm/preempt.h | 10 --
> arch/loongarch/Kconfig | 1 -
> arch/powerpc/Kconfig | 1 -
> arch/riscv/Kconfig | 1 -
> arch/s390/Kconfig | 1 -
> arch/s390/include/asm/preempt.h | 11 --
> arch/x86/Kconfig | 1 -
> arch/x86/include/asm/preempt.h | 28 -----
> include/asm-generic/preempt.h | 10 --
> include/linux/irq-entry-common.h | 17 +--
> include/linux/kernel.h | 20 ----
> include/linux/preempt.h | 20 ++--
> include/linux/sched.h | 31 +-----
> kernel/Kconfig.preempt | 9 +-
> kernel/entry/common.c | 17 +--
> kernel/sched/core.c | 180 +------------------------------
> 18 files changed, 23 insertions(+), 374 deletions(-)
>
On 03/08/2026 21:17, Mark Rutland wrote:
> All architectures which currently suppoort PREEMPT_DYNAMIC select
> ARCH_HAS_PREEMPT_LAZY. On architectures which select
> ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and
> VOLUNTARY preemption models since v7.0 due to commit:
>
> 7dadeaa6e851 ("sched: Further restrict the preemption modes")
>
> Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or
> VOLUNTARY preemption models.
>
> This series makes the de-facto situation official by making
> PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing redundant
> code.
>
> Since v1, I've had to rebase atop v7.2-rc4 to avoid a conflict with
> commit:
>
> a2c02aa0c6ca ("powerpc: Remove dead non-preemption code")
>
> Given this is now late in the cycle, and given the tip:sched/core branch
> is based on v7.2-rc1, I suspect tip folk might not want to queue this
> now. Please let me know what you'd prefer; I'm happy to rebase and
> resend after v7.3-rc1.
>
> Since v1:
> * Rebase to v7.2-rc4
> * Apply Revied-by tags.
> * Fix typos in commit messages.
> * Add patch to cleanup accessors (per Shrikanth's comment)
>
> Mark.
>
Hi, I once again did a build test and the results
are looking the same;
$ ls -la baseline/vmlinux patched/vmlinux
-rwxrwxr-x 1 meted meted 409534568 Aug 5 11:38 baseline/vmlinux
-rwxrwxr-x 1 meted meted 408212872 Aug 5 10:50 patched/vmlinux
$ ls -la baseline/bzImage patched/bzImage
-rwxrwxr-x 1 meted meted 12922880 Aug 5 11:38 baseline/bzImage
-rwxrwxr-x 1 meted meted 12890112 Aug 5 10:51 patched/bzImage
Both bzImage and vmlinux are shrunk after the patch for s390.
bzImage ~32K smaller
vmlinux ~1.2M smaller
FWIW, here is my tested-by;
Tested-by: Mete Durlu <meted@linux.ibm.com>
© 2016 - 2026 Red Hat, Inc.