From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
philip.li@intel.com, Ingo Molnar <mingo@kernel.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH] sched: Have BUG_ON() check if linker sched classes don't line up correctly
Date: Sat, 20 Jun 2020 00:38:23 +0200 [thread overview]
Message-ID: <20200619223823.GL576888@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200619180219.0d558512@oasis.local.home>
On Fri, Jun 19, 2020 at 06:02:19PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt (VMware) <rostedt@goodmis.org>
>
> If the sched_class structures do not match how the compiler thinks they
> are in an array, it can cause hard to debug bugs. Change the BUG_ON()
> from making sure each of the sched classes are in the proper order, to
> also making sure they are off by the proper amount.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7ad864dc3ac5..876d7ecdab52 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6635,12 +6635,13 @@ void __init sched_init(void)
> unsigned long ptr = 0;
> int i;
>
> - BUG_ON(&idle_sched_class > &fair_sched_class ||
> - &fair_sched_class > &rt_sched_class ||
> - &rt_sched_class > &dl_sched_class);
> + /* Make sure the linker didn't screw up */
> + BUG_ON(&idle_sched_class + 1 != &fair_sched_class ||
> + &fair_sched_class + 1 != &rt_sched_class ||
> + &rt_sched_class + 1 != &dl_sched_class);
>
> #ifdef CONFIG_SMP
> - BUG_ON(&dl_sched_class > &stop_sched_class);
> + BUG_ON(&dl_sched_class + 1 != &stop_sched_class);
> #endif
Nice, I'll fold that.
prev parent reply other threads:[~2020-06-19 22:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 22:02 Steven Rostedt
2020-06-19 22:38 ` Peter Zijlstra [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=20200619223823.GL576888@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=philip.li@intel.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
/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®