From d5d3d33ff385eab2f628175cb35fa11e013d89ec Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 27 Jan 2021 09:22:25 -0800 Subject: [PATCH] sched: walt: Fixup root domain selection In WALT task placement algorithm, we select the root domain to be the root domain corresponding to the current cpu, however, this could be null if the cpu is inactive. This, in fact, resulted in undesired behaviour when evaluating a single old threaded usecase, since desired cpu was inactive, thread was being placed on a fallback cpu. Change-Id: I68eef10dc84db15796a0d43af7215f4dbbdc059e Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt_cfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index ce47fc59a017..6c2c6415e444 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -552,7 +552,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sync, int sibling_count_hint) { unsigned long prev_delta = ULONG_MAX, best_delta = ULONG_MAX; - struct root_domain *rd = cpu_rq(smp_processor_id())->rd; + struct root_domain *rd = cpu_rq(cpumask_first(cpu_active_mask))->rd; int weight, cpu = smp_processor_id(), best_energy_cpu = prev_cpu; struct perf_domain *pd; unsigned long cur_energy;