mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Don <joshdon@google.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Vineeth Pillai <vineethrp@gmail.com>, Hao Luo <haoluo@google.com>,
	linux-kernel@vger.kernel.org, Josh Don <joshdon@google.com>
Subject: [PATCH] sched/core: explicitly initialize coresched state
Date: Wed, 10 Nov 2021 11:27:40 -0800	[thread overview]
Message-ID: <20211110192740.358437-1-joshdon@google.com> (raw)

Some coresched state may be left as non-zero when we flip off coresched
(ie. core_cookie, core_forceidle_count, etc.). This won't cause any
issues when we flip coresched back on, but it is better to be more
explicit about resetting this state.

Signed-off-by: Josh Don <joshdon@google.com>
---
 kernel/sched/core.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b0be8ad6bb7e..2c17f5e91402 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -282,13 +282,23 @@ static void __sched_core_flip(bool enabled)
 	cpumask_copy(&sched_core_mask, cpu_online_mask);
 	for_each_cpu(cpu, &sched_core_mask) {
 		const struct cpumask *smt_mask = cpu_smt_mask(cpu);
+		struct rq *rq;
 
 		sched_core_lock(cpu, &flags);
 
-		for_each_cpu(t, smt_mask)
-			cpu_rq(t)->core_enabled = enabled;
+		for_each_cpu(t, smt_mask) {
+			rq = cpu_rq(t);
+
+			rq->core_pick = NULL;
+			rq->core_enabled = enabled;
+
+		}
 
-		cpu_rq(cpu)->core->core_forceidle_start = 0;
+		rq = cpu_rq(cpu)->core;
+		rq->core_cookie = 0;
+		rq->core_forceidle_count = 0;
+		rq->core_forceidle_occupation = 0;
+		rq->core_forceidle_start = 0;
 
 		sched_core_unlock(cpu, &flags);
 
-- 
2.34.0.rc0.344.g81b53c2807-goog


                 reply	other threads:[~2021-11-10 19:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211110192740.358437-1-joshdon@google.com \
    --to=joshdon@google.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=haoluo@google.com \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vineethrp@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

Powered by JetHome