path: root/kernel
diff options
authorQuentin Perret <>2019-09-20 11:41:15 +0200
committerIngo Molnar <>2019-09-25 17:42:32 +0200
commit4892f51ad54ddff2883a60b6ad4323c1f632a9d6 (patch)
treefae92c41feea34131bc861123220f2efb33bdd6a /kernel
parent9fc41acc89e58262c917b4be89ef00a87485804f (diff)
sched/fair: Avoid redundant EAS calculation
The EAS wake-up path computes the system energy for several CPU candidates: the CPU with maximum spare capacity in each performance domain, and the prev_cpu. However, if prev_cpu also happens to be the CPU with maximum spare capacity in its performance domain, the energy calculation is still done twice, unnecessarily. Add a condition to filter out this corner case before doing the energy calculation. Reported-by: Pavan Kondeti <> Signed-off-by: Quentin Perret <> Signed-off-by: Peter Zijlstra (Intel) <> Cc: Linus Torvalds <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: eb92692b2544 ("sched/fair: Speed-up energy-aware wake-ups") Link: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'kernel')
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index dfdac90fd211..83ab35e2374f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6389,7 +6389,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
/* Evaluate the energy impact of using this CPU. */
- if (max_spare_cap_cpu >= 0) {
+ if (max_spare_cap_cpu >= 0 && max_spare_cap_cpu != prev_cpu) {
cur_delta = compute_energy(p, max_spare_cap_cpu, pd);
cur_delta -= base_energy_pd;
if (cur_delta < best_delta) {