The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Mark Rutland <mark.rutland@arm.com>, linux-kernel@vger.kernel.org
Cc: frederic@kernel.org, jstultz@google.com, juri.lelli@redhat.com,
	mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de,
	vincent.guittot@linaro.org, vschneid@redhat.com
Subject: Re: [PATCH 0/5] sched: dynamic: Simplify PREEMPT_DYNAMIC
Date: Mon, 6 Jul 2026 10:00:47 +0530	[thread overview]
Message-ID: <54d24191-efd1-418d-92df-20ca6d385675@linux.ibm.com> (raw)
In-Reply-To: <20260703133358.698078-1-mark.rutland@arm.com>

Hi Mark,

On 7/3/26 7:03 PM, 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 all the
> redundant code.

This cleanup looks good indeed. little bit more cleanup can be added,
details of it at the end.

> 
> For x86_64 v7.2-rc1 defconfig built with GCC 10.2.1, this makes the
> bzImage 28K smaller, mostly due to removing NOPs that will never be
> patched to {cond,might}_resched() at runtime:
> 
>    [mark@lakrids:~/src/linux]% ls -al vmlinux-*
>    -rwxr-xr-x 1 mark mark 53844952 Jul  3 14:09 vmlinux-after
>    -rwxr-xr-x 1 mark mark 53842856 Jul  3 14:09 vmlinux-before

Is this reversed? How come vmlinux is more whereas bzImage is less?

>    [mark@lakrids:~/src/linux]% ls -al bzImage-*
>    -rw-r--r-- 1 mark mark 14771200 Jul  3 14:09 bzImage-after
>    -rw-r--r-- 1 mark mark 14799872 Jul  3 14:08 bzImage-before
> 
> Mark.
> 
> Mark Rutland (5):
>    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}
> 
>   arch/Kconfig                       |  38 -------
>   arch/arm64/Kconfig                 |   1 -
>   arch/arm64/include/asm/preempt.h   |  10 --
>   arch/loongarch/Kconfig             |   1 -
>   arch/powerpc/Kconfig               |   1 -
>   arch/powerpc/include/asm/preempt.h |   7 --
>   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/sched.h              |  31 +----
>   kernel/Kconfig.preempt             |   9 +-
>   kernel/entry/common.c              |  17 +--
>   kernel/sched/core.c                | 176 +----------------------------
>   18 files changed, 13 insertions(+), 367 deletions(-)
> 

Btw, I ran it on powerpc, builds and boots.
Bloat-o-meter says,
Total: Before=32286154, After=32267870, chg -0.06%


In addition,
I think you can also remove accessor methods of none, voluntary.
I see preempt_model_none is used. (Though one may question its usage there).
That wrapper can be outside of #ifdef as preempt dynamic can't choose
none/voluntary.

---

diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index d964f965c8ff..b4dd4fc13cf8 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -469,22 +469,9 @@ DEFINE_LOCK_GUARD_0(preempt, preempt_disable(), preempt_enable())
  DEFINE_LOCK_GUARD_0(preempt_notrace, preempt_disable_notrace(), preempt_enable_notrace())
  
  #ifdef CONFIG_PREEMPT_DYNAMIC
-
-extern bool preempt_model_none(void);
-extern bool preempt_model_voluntary(void);
  extern bool preempt_model_full(void);
  extern bool preempt_model_lazy(void);
-
  #else
-
-static inline bool preempt_model_none(void)
-{
-       return IS_ENABLED(CONFIG_PREEMPT_NONE);
-}
-static inline bool preempt_model_voluntary(void)
-{
-       return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY);
-}
  static inline bool preempt_model_full(void)
  {
         return IS_ENABLED(CONFIG_PREEMPT);
@@ -494,9 +481,16 @@ static inline bool preempt_model_lazy(void)
  {
         return IS_ENABLED(CONFIG_PREEMPT_LAZY);
  }
-
  #endif
  
+static inline bool preempt_model_none(void)
+{
+       return IS_ENABLED(CONFIG_PREEMPT_NONE);
+}
+static inline bool preempt_model_voluntary(void)
+{
+       return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY);
+}
  static inline bool preempt_model_rt(void)
  {
         return IS_ENABLED(CONFIG_PREEMPT_RT);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9eb279eade26..59a8c8e63ca1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7815,8 +7815,6 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write);
  
  enum {
         preempt_dynamic_undefined = -1,
-       preempt_dynamic_none,
-       preempt_dynamic_voluntary,
         preempt_dynamic_full,
         preempt_dynamic_lazy,
  };
@@ -7901,8 +7899,6 @@ static void __init preempt_dynamic_init(void)
         }                                                               \
         EXPORT_SYMBOL_GPL(preempt_model_##mode)
  
-PREEMPT_MODEL_ACCESSOR(none);
-PREEMPT_MODEL_ACCESSOR(voluntary);
  PREEMPT_MODEL_ACCESSOR(full);
  PREEMPT_MODEL_ACCESSOR(lazy);
  


      parent reply	other threads:[~2026-07-06  4:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 13:33 [PATCH 0/5] sched: dynamic: Simplify PREEMPT_DYNAMIC Mark Rutland
2026-07-03 13:33 ` [PATCH 1/5] sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY Mark Rutland
2026-07-06  4:36   ` Shrikanth Hegde
2026-07-03 13:33 ` [PATCH 2/5] sched: dynamic: Simplify {cond,might}_resched() Mark Rutland
2026-07-06  4:59   ` Shrikanth Hegde
2026-07-03 13:33 ` [PATCH 3/5] sched: dynamic: Simplify preempt_schedule{,_notrace}() Mark Rutland
2026-07-06  5:19   ` Shrikanth Hegde
2026-07-03 13:33 ` [PATCH 4/5] sched: dynamic: Simplify irqentry_exit_cond_resched() Mark Rutland
2026-07-06  4:42   ` Shrikanth Hegde
2026-07-03 13:33 ` [PATCH 5/5] sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY} Mark Rutland
2026-07-06  4:30 ` Shrikanth Hegde [this message]

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=54d24191-efd1-418d-92df-20ca6d385675@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=frederic@kernel.org \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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