From: Ingo Molnar <mingo@kernel.org>
To: WANG Chao <wcwxyz@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: unlikely corrupted stack end
Date: Tue, 14 Jun 2016 09:43:46 +0200 [thread overview]
Message-ID: <20160614074346.GA9689@gmail.com> (raw)
In-Reply-To: <20160614064306.48035-1-wcwxyz@gmail.com>
* WANG Chao <wcwxyz@gmail.com> wrote:
> unlikely() was dropped in commit ce03e41 ("sched/core: Drop unlikely
> behind BUG_ON()"), but commit 29d6455 ("sched: panic on corrupted stack
> end") dropped BUG_ON() and called panic directly.
>
> Now we should bring unlikely() back for branch prediction.
>
> Signed-off-by: WANG Chao <wcwxyz@gmail.com>
> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 017d539..7db442c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3170,7 +3170,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
> static inline void schedule_debug(struct task_struct *prev)
> {
> #ifdef CONFIG_SCHED_STACK_END_CHECK
> - if (task_stack_end_corrupted(prev))
> + if (unlikely(task_stack_end_corrupted(prev)))
> panic("corrupted stack end detected inside scheduler\n");
> #endif
It would be better and cleaner to push that into the task_stack_end_corrupted()
definition. (and to turn it into an inline function while we are touching it.)
Thanks,
Ingo
next prev parent reply other threads:[~2016-06-14 7:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 6:43 [PATCH] sched: unlikely corrupted stack end WANG Chao
2016-06-14 7:43 ` Ingo Molnar [this message]
2016-06-14 8:17 ` Peter Zijlstra
2016-06-14 8:24 ` [PATCH v2] " WANG Chao
2016-06-14 8:56 ` Ingo Molnar
2016-06-14 10:17 ` WANG Chao
2016-06-14 10:26 ` Ingo Molnar
2016-06-14 16:55 ` WANG Chao
2016-06-15 8:25 ` Ingo Molnar
2016-06-15 8:53 ` [PATCH v3] " WANG Chao
2016-06-14 9:08 ` [PATCH v2] " kbuild test robot
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=20160614074346.GA9689@gmail.com \
--to=mingo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=wcwxyz@gmail.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;
as well as URLs for NNTP newsgroup(s).