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 2/5] sched: dynamic: Simplify {cond,might}_resched()
Date: Mon, 6 Jul 2026 10:29:26 +0530	[thread overview]
Message-ID: <c2bc66ae-547d-4413-bf69-262d7862af3d@linux.ibm.com> (raw)
In-Reply-To: <20260703133358.698078-3-mark.rutland@arm.com>



On 7/3/26 7:03 PM, Mark Rutland wrote:
> PREEMPT_DYNAMIC is now limited to the FULL and LAZY preemption models.
> In either model, both cond_resched() and might_resched() are always
> disabled and do nothing.
> 
> Remove the unnecessary code for these when PREEMPT_DYNAMIC is selected.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.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: Thomas Gleixner <tglx@linutronix.de>
> Cc: Valentin Schneider <vschneid@redhat.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>   include/linux/kernel.h | 20 -------------------
>   include/linux/sched.h  | 31 +++--------------------------
>   kernel/sched/core.c    | 44 +-----------------------------------------
>   3 files changed, 4 insertions(+), 91 deletions(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index e5570a16cbb1a..533ee1e6e1cb7 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -43,30 +43,10 @@ struct completion;
>   struct user;
>   
>   #ifdef CONFIG_PREEMPT_VOLUNTARY_BUILD

Would it make sense to move this block under CONFIG_PREEMPT_VOLUNTARY_BUILD
to include/linux/sched.h so they all in one header?

this builds. I meant something like below.
---

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 533ee1e6e1cb..49495eb754d5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -42,13 +42,6 @@
  struct completion;
  struct user;
  
-#ifdef CONFIG_PREEMPT_VOLUNTARY_BUILD
-extern int __cond_resched(void);
-# define might_resched() __cond_resched()
-#else
-# define might_resched() do { } while (0)
-#endif /* CONFIG_PREEMPT_* */
-
  #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
  extern void __might_resched(const char *file, int line, unsigned int offsets);
  extern void __might_sleep(const char *file, int line);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index db6e757e83c7..ddc9aae96e55 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2112,6 +2112,13 @@ static inline void set_need_resched_current(void)
         set_preempt_need_resched();
  }
  
+#ifdef CONFIG_PREEMPT_VOLUNTARY_BUILD
+extern int __cond_resched(void);
+# define might_resched() __cond_resched()
+#else
+# define might_resched() do { } while (0)
+#endif /* CONFIG_PREEMPT_* */
+
  /*
   * cond_resched() and cond_resched_lock(): latency reduction via
   * explicit rescheduling in places that are safe. The return


> -
>   extern int __cond_resched(void);
>   # define might_resched() __cond_resched()
> -
> -#elif defined(CONFIG_PREEMPT_DYNAMIC) && defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
> -
> -extern int __cond_resched(void);
> -
> -DECLARE_STATIC_CALL(might_resched, __cond_resched);
> -
> -static __always_inline void might_resched(void)
> -{
> -	static_call_mod(might_resched)();
> -}
> -
> -#elif defined(CONFIG_PREEMPT_DYNAMIC) && defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
> -
> -extern int dynamic_might_resched(void);
> -# define might_resched() dynamic_might_resched()
> -
>   #else
> -
>   # define might_resched() do { } while (0)
> -
>   #endif /* CONFIG_PREEMPT_* */
>   
>   #ifdef CONFIG_DEBUG_ATOMIC_SLEEP


Other than that, rest looks good to me.

Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>

  reply	other threads:[~2026-07-06  5:00 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 [this message]
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 ` [PATCH 0/5] sched: dynamic: Simplify PREEMPT_DYNAMIC Shrikanth Hegde

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=c2bc66ae-547d-4413-bf69-262d7862af3d@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