mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/core: explicitly initialize coresched state
@ 2021-11-10 19:27 Josh Don
  0 siblings, 0 replies; only message in thread
From: Josh Don @ 2021-11-10 19:27 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Joel Fernandes, Vineeth Pillai,
	Hao Luo, linux-kernel, Josh Don

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-10 19:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 19:27 [PATCH] sched/core: explicitly initialize coresched state Josh Don

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