Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d7a6b8be authored by Joonwoo Park's avatar Joonwoo Park Committed by Todd Kjos
Browse files

sched: EAS: fix incorrect energy delta calculation due to rounding error



In order to calculate energy difference we currently iterates CPUs under
the same sched doamin to accumulate total energy cost and compare before
and after :

  for_each_domain(cpu)
          total_energy_before += (cpu_util * power) >> SCHED_CAPACITY_SHIFT;

  for_each_domain(cpu)
          total_energy_after += (cpu_util * power) >> SCHED_CAPACITY_SHIFT;

Doing such can incorrectly calculate and report abs(delta) > 0 when
there is actually no energy delta between before and after because the
same total accumulated cpu_util of all the CPUs can be distributed
differently before and after and it causes different amount of rounding
error.

Fix such incorrectness by shifting just once with accumulated
total_energy.

Change-Id: I82f1e2e358367058960938b4ef81714f57e921cf
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
(moved part to another commit)
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
(cherry picked from commit 11b618a0b2fc8598474a518add7037d4005d83e8)
[trivial cherry-pick issues]
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
parent 8b34bba6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment