mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Amin Gattout <amin.gattout@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/core: Convert remaining BUG_ON() instances to WARN_ON_ONCE()
Date: Thu, 27 Aug 2026 13:42:29 +0200	[thread overview]
Message-ID: <20260827114229.GK687043@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260827-warn_instead_bug-v1-1-b515c0f74b89@gmail.com>

On Thu, Aug 27, 2026 at 01:40:14PM +0200, Amin Gattout wrote:
> Commit 09348d75a6ce ("sched/all: Change all BUG_ON() instances in the
> scheduler to WARN_ON_ONCE()") left a few BUG_ON() behind in core.c.
> Convert them as well.
> 
> As described in Documentation/process/deprecated.rst, BUG_ON() crashes
> the system, which makes the failure harder to report and to debug, as
> the message often never reaches the console or the syslog. With
> WARN_ON_ONCE() the user gets a chance to see and report the problem
> instead, and system owners who do not want to keep running after an
> "impossible" condition can still set panic_on_warn.
> 
> Signed-off-by: Amin Gattout <amin.gattout@gmail.com>
> ---
> Follow-up to commit 09348d75a6ce which converted the scheduler BUG_ON()
> instances to WARN_ON_ONCE() but left a few behind in core.c.
> 
> Build tested on arm64 with CONFIG_NO_HZ_FULL and CONFIG_SCHED_CLASS_EXT
> enabled so that every converted site is compiled.
> ---
>  kernel/sched/core.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f78275192036..bab74b4f0dd6 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5949,7 +5949,7 @@ static void sched_tick_stop(int cpu)
>  int __init sched_tick_offload_init(void)
>  {
>  	tick_work_cpu = alloc_percpu(struct tick_work);
> -	BUG_ON(!tick_work_cpu);
> +	WARN_ON_ONCE(!tick_work_cpu);
>  	return 0;
>  }
>  

> @@ -8954,13 +8954,13 @@ void __init sched_init(void)
>  	int i;
>  
>  	/* Make sure the linker didn't screw up */
> -	BUG_ON(!sched_class_above(&stop_sched_class, &dl_sched_class));
> -	BUG_ON(!sched_class_above(&dl_sched_class, &rt_sched_class));
> -	BUG_ON(!sched_class_above(&rt_sched_class, &fair_sched_class));
> -	BUG_ON(!sched_class_above(&fair_sched_class, &idle_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&stop_sched_class, &dl_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&dl_sched_class, &rt_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&rt_sched_class, &fair_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&fair_sched_class, &idle_sched_class));
>  #ifdef CONFIG_SCHED_CLASS_EXT
> -	BUG_ON(!sched_class_above(&fair_sched_class, &ext_sched_class));
> -	BUG_ON(!sched_class_above(&ext_sched_class, &idle_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&fair_sched_class, &ext_sched_class));
> +	WARN_ON_ONCE(!sched_class_above(&ext_sched_class, &idle_sched_class));
>  #endif
>  

These all really should be BUG_ON(), there is absolutely no point in
tying to complete the boot if they fail.



  reply	other threads:[~2026-08-27 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 11:40 Amin Gattout
2026-08-27 11:42 ` Peter Zijlstra [this message]
2026-08-27 11:45   ` Amin

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=20260827114229.GK687043@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=amin.gattout@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --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®