public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Check idle_cpu in select_idle_core/cpu()
@ 2021-10-09 18:09 Tao Zhou
  2021-10-09 22:50 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Tao Zhou @ 2021-10-09 18:09 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira
  Cc: Tao Zhou

In select_idle_core(), the idle core returned may have no cpu
allowed. I think the idle core returned for the task is the one
that can be allowed to run. I insist on this semantics.

In select_idle_cpu(), if select_idle_core() can not find the
idle core, one reason is that the core is not allowed for the
task, but the core itself is idle from the point of
sds->has_idle_cores. I insist on this semantics.

No others, just two additional check.
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f6a05d9b5443..a44aca5095d3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6213,7 +6213,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu
 			*idle_cpu = cpu;
 	}
 
-	if (idle)
+	if (idle && *idle_cpu != -1)
 		return core;
 
 	cpumask_andnot(cpus, cpus, cpu_smt_mask(core));
@@ -6324,7 +6324,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
 		}
 	}
 
-	if (has_idle_core)
+	if (has_idle_core && *idle_cpu != -1)
 		set_idle_cores(target, false);
 
 	if (sched_feat(SIS_PROP) && !has_idle_core) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-10 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-09 18:09 [PATCH] sched/fair: Check idle_cpu in select_idle_core/cpu() Tao Zhou
2021-10-09 22:50 ` Peter Zijlstra
2021-10-10  9:39   ` Tao Zhou
2021-10-10 12:19     ` Barry Song
2021-10-10 14:27       ` Tao Zhou
2021-10-10 20:24         ` Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox