sched/fair: Check if prev_cpu has highest spare cap in feec()
authorPierre Gondois <pierre.gondois@arm.com>
Thu, 6 Oct 2022 08:10:52 +0000 (10:10 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 27 Oct 2022 09:01:20 +0000 (11:01 +0200)
commitad841e569f5c88e3332b32a000f251f33ff32187
tree3639305c4da4227530170297590eee542eb1adf9
parentaa69c36f31aadc1669bfa8a3de6a47b5e6c98ee8
sched/fair: Check if prev_cpu has highest spare cap in feec()

When evaluating the CPU candidates in the perf domain (pd) containing
the previously used CPU (prev_cpu), find_energy_efficient_cpu()
evaluates the energy of the pd:
- without the task (base_energy)
- with the task placed on prev_cpu (if the task fits)
- with the task placed on the CPU with the highest spare capacity,
  prev_cpu being excluded from this set

If prev_cpu is already the CPU with the highest spare capacity,
max_spare_cap_cpu will be the CPU with the second highest spare
capacity.

On an Arm64 Juno-r2, with a workload of 10 tasks at a 10% duty cycle,
when prev_cpu and max_spare_cap_cpu are both valid candidates,
prev_spare_cap > max_spare_cap at ~82%.
Thus the energy of the pd when placing the task on max_spare_cap_cpu
is computed with no possible positive outcome 82% most of the time.

Do not consider max_spare_cap_cpu as a valid candidate if
prev_spare_cap > max_spare_cap.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20221006081052.3862167-2-pierre.gondois@arm.com
kernel/sched/fair.c