mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Mark Rutland <mark.rutland@arm.com>, <linux-kernel@vger.kernel.org>
Cc: <frederic@kernel.org>, <jstultz@google.com>,
	<juri.lelli@redhat.com>, <meted@linux.ibm.com>,
	<mingo@redhat.com>, <peterz@infradead.org>,
	<sshegde@linux.ibm.com>, <tglx@linutronix.de>,
	<vincent.guittot@linaro.org>, <vschneid@redhat.com>
Subject: Re: [PATCH v2 4/6] sched: dynamic: Simplify irqentry_exit_cond_resched()
Date: Fri, 7 Aug 2026 09:35:12 +0800	[thread overview]
Message-ID: <62a5fb7c-ac55-4b28-aaae-09d55da36545@huawei.com> (raw)
In-Reply-To: <20260803191731.3244294-5-mark.rutland@arm.com>



在 2026/8/4 3:17, Mark Rutland 写道:
> PREEMPT_DYNAMIC is now limited to the FULL and LAZY preemption models.
> In either model, irqentry_exit_cond_resched() is always called and never
> disabled.

Hi Mark,

Is it necessary to mention that all architectures supporting generic irq
entry support PREEMPT_DYNAMIC?

> 
> Remove the unnecessary code for this when PREEMPT_DYNAMIC is selected.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: John Stultz <jstultz@google.com>
> Cc: Juri Lelli <juri.lelli@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Valentin Schneider <vschneid@redhat.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>  include/linux/irq-entry-common.h | 17 +----------------
>  kernel/entry/common.c            | 17 ++---------------
>  kernel/sched/core.c              |  7 -------
>  3 files changed, 3 insertions(+), 38 deletions(-)
> 
> diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h
> index 1fabf0f5ea8e7..de7e10de91d04 100644
> --- a/include/linux/irq-entry-common.h
> +++ b/include/linux/irq-entry-common.h
> @@ -346,22 +346,7 @@ typedef struct irqentry_state {
>   *
>   * Conditional reschedule with additional sanity checks.
>   */
> -void raw_irqentry_exit_cond_resched(void);
> -
> -#ifdef CONFIG_PREEMPT_DYNAMIC
> -#if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
> -#define irqentry_exit_cond_resched_dynamic_enabled	raw_irqentry_exit_cond_resched
> -#define irqentry_exit_cond_resched_dynamic_disabled	NULL
> -DECLARE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched);
> -#define irqentry_exit_cond_resched()	static_call(irqentry_exit_cond_resched)()
> -#elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
> -DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched);
> -void dynamic_irqentry_exit_cond_resched(void);
> -#define irqentry_exit_cond_resched()	dynamic_irqentry_exit_cond_resched()
> -#endif
> -#else /* CONFIG_PREEMPT_DYNAMIC */
> -#define irqentry_exit_cond_resched()	raw_irqentry_exit_cond_resched()
> -#endif /* CONFIG_PREEMPT_DYNAMIC */
> +void irqentry_exit_cond_resched(void);
>  
>  /**
>   * irqentry_enter_from_kernel_mode - Establish state before invoking the irq handler
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index e3d381fd3d251..e234b04373fea 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -123,7 +123,7 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs)
>  /**
>   * arch_irqentry_exit_need_resched - Architecture specific need resched function
>   *
> - * Invoked from raw_irqentry_exit_cond_resched() to check if resched is needed.
> + * Invoked from irqentry_exit_cond_resched() to check if resched is needed.
>   * Defaults return true.
>   *
>   * The main purpose is to permit arch to avoid preemption of a task from an IRQ.
> @@ -134,7 +134,7 @@ static inline bool arch_irqentry_exit_need_resched(void);
>  static inline bool arch_irqentry_exit_need_resched(void) { return true; }
>  #endif
>  
> -void raw_irqentry_exit_cond_resched(void)
> +void irqentry_exit_cond_resched(void)
>  {
>  	if (!preempt_count()) {
>  		/* Sanity check RCU and thread stack */
> @@ -145,19 +145,6 @@ void raw_irqentry_exit_cond_resched(void)
>  			preempt_schedule_irq();
>  	}
>  }

Otherwise, LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>

> -#ifdef CONFIG_PREEMPT_DYNAMIC
> -#if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
> -DEFINE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched);
> -#elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
> -DEFINE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched);
> -void dynamic_irqentry_exit_cond_resched(void)
> -{
> -	if (!static_branch_unlikely(&sk_dynamic_irqentry_exit_cond_resched))
> -		return;
> -	raw_irqentry_exit_cond_resched();
> -}
> -#endif
> -#endif
>  
>  noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
>  {
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f88b9ef70a0dd..4f754f4a472f8 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7788,9 +7788,6 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write);
>  # endif
>  
>  /*
> - * SC:irqentry_exit_cond_resched
> - *
> - *
>   * NONE:
>   *   (unselectable)
>   *
> @@ -7798,11 +7795,9 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write);
>   *   (unselectable)
>   *
>   * FULL:
> - *   irqentry_exit_cond_resched <- irqentry_exit_cond_resched
>   *   dynamic_preempt_lazy       <- false
>   *
>   * LAZY:
> - *   irqentry_exit_cond_resched <- irqentry_exit_cond_resched
>   *   dynamic_preempt_lazy       <- true
>   */
>  
> @@ -7846,14 +7841,12 @@ static void __sched_dynamic_update(int mode)
>  {
>  	switch (mode) {
>  	case preempt_dynamic_full:
> -		preempt_dynamic_enable(irqentry_exit_cond_resched);
>  		preempt_dynamic_key_disable(preempt_lazy);
>  		if (mode != preempt_dynamic_mode)
>  			pr_info("Dynamic Preempt: full\n");
>  		break;
>  
>  	case preempt_dynamic_lazy:
> -		preempt_dynamic_enable(irqentry_exit_cond_resched);
>  		preempt_dynamic_key_enable(preempt_lazy);
>  		if (mode != preempt_dynamic_mode)
>  			pr_info("Dynamic Preempt: lazy\n");


  reply	other threads:[~2026-08-07  1:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 19:17 [PATCH v2 0/6] sched: dynamic: Simplify PREEMPT_DYNAMIC Mark Rutland
2026-08-03 19:17 ` [PATCH v2 1/6] sched: dynamic: Make PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY Mark Rutland
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-03 19:17 ` [PATCH v2 2/6] sched: dynamic: Simplify {cond,might}_resched() Mark Rutland
2026-08-05 10:08   ` Jinjie Ruan
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-03 19:17 ` [PATCH v2 3/6] sched: dynamic: Simplify preempt_schedule{,_notrace}() Mark Rutland
2026-08-06 13:23   ` Jinjie Ruan
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-03 19:17 ` [PATCH v2 4/6] sched: dynamic: Simplify irqentry_exit_cond_resched() Mark Rutland
2026-08-07  1:35   ` Jinjie Ruan [this message]
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-03 19:17 ` [PATCH v2 5/6] sched: dynamic: Remove HAVE_PREEMPT_DYNAMIC_{CALL,KEY} Mark Rutland
2026-08-07  1:54   ` Jinjie Ruan
2026-09-01 15:26     ` Mark Rutland
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-03 19:17 ` [PATCH v2 6/6] sched: dynamic: Simplify preempt model accessors Mark Rutland
2026-08-07  2:00   ` Jinjie Ruan
2026-09-01 16:03     ` Mark Rutland
2026-09-02  7:54   ` [tip: sched/core] " tip-bot2 for Mark Rutland
2026-08-05  9:52 ` [PATCH v2 0/6] sched: dynamic: Simplify PREEMPT_DYNAMIC Mete Durlu
2026-08-06 12:15 ` Shrikanth Hegde
2026-08-07  3:11 ` Jinjie Ruan
2026-09-03  1:30   ` Jinjie Ruan
2026-08-07  3:33 ` Jinjie Ruan
2026-09-01 16:04   ` Mark Rutland

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=62a5fb7c-ac55-4b28-aaae-09d55da36545@huawei.com \
    --to=ruanjinjie@huawei.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=meted@linux.ibm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sshegde@linux.ibm.com \
    --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

all inboxes | Powered by JetHome®