mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: Sasha Levin <sasha.levin@oracle.com>,
	Yao Dongdong <yaodongdong@huawei.com>
Subject: [PATCH] sched/core: really pretend early bootup to be a normal task
Date: Tue, 05 Jul 2016 14:23:23 +0300	[thread overview]
Message-ID: <146771780366.86926.5349525389994177302.stgit@buzz> (raw)

Commit 1b537c7d1e58 ("sched/core: Remove check of p->sched_class") placed
"current->sched_class = &fair_sched_class" before call of init_idle() which
immediately set sched_class back to idle_sched_class.

This patch reverts this piece because after commit de9b8f5dcbd9 ("sched:
Fix crash trying to dequeue/enqueue the idle thread") init_idle() doesn't
call do_set_cpus_allowed() and nobody will dereference ->sched_class.

[ Probably this pretending is no longer required and could be removed,
  or maybe it helps in catching bugs like sleeping during early bootup? ]

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 1b537c7d1e58 ("sched/core: Remove check of p->sched_class")
Cc: Yao Dongdong <yaodongdong@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/sched/core.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 51d7105f529a..c23aee77d10d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7481,11 +7481,6 @@ void __init sched_init(void)
 	enter_lazy_tlb(&init_mm, current);
 
 	/*
-	 * During early bootup we pretend to be a normal task:
-	 */
-	current->sched_class = &fair_sched_class;
-
-	/*
 	 * Make us the idle thread. Technically, schedule() should not be
 	 * called from this thread, however somewhere below it might be,
 	 * but because we are the idle thread, we just pick up running again
@@ -7495,6 +7490,11 @@ void __init sched_init(void)
 
 	calc_load_update = jiffies + LOAD_FREQ;
 
+	/*
+	 * During early bootup we pretend to be a normal task:
+	 */
+	current->sched_class = &fair_sched_class;
+
 #ifdef CONFIG_SMP
 	zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT);
 	/* May be allocated at isolcpus cmdline parse time */

             reply	other threads:[~2016-07-05 11:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 11:23 Konstantin Khlebnikov [this message]
2016-07-05 12:41 ` Peter Zijlstra
2016-07-05 12:47   ` Konstantin Khlebnikov

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=146771780366.86926.5349525389994177302.stgit@buzz \
    --to=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sasha.levin@oracle.com \
    --cc=yaodongdong@huawei.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®