Skip to content

Commit 4892f51

Browse files
qperretIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Quentin Perret <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Fixes: eb92692 ("sched/fair: Speed-up energy-aware wake-ups") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 9fc41ac commit 4892f51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/fair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6389,7 +6389,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
63896389
}
63906390

63916391
/* Evaluate the energy impact of using this CPU. */
6392-
if (max_spare_cap_cpu >= 0) {
6392+
if (max_spare_cap_cpu >= 0 && max_spare_cap_cpu != prev_cpu) {
63936393
cur_delta = compute_energy(p, max_spare_cap_cpu, pd);
63946394
cur_delta -= base_energy_pd;
63956395
if (cur_delta < best_delta) {

0 commit comments

Comments
 (0)