sched: Energy model functions
Introduces energy_diff_util() which finds the energy impacts of adding
or removing utilization from a specific cpu. The calculation is based on
the energy information provided by the platform through sched_energy
data in the sched_domain hierarchy.
Task and cpu utilization is currently based on load_avg_contrib and
weighted_cpuload() which are actually load, not utilization. We don't
have a solution for utilization yet. There are several other loose ends
that need to be addressed, such as load/utilization invariance and
proper representation of compute capacity. However, the energy model is
there.
The energy cost model only considers utilization (busy time) and idle
energy (remaining time) for now. The basic idea is to determine the
energy cost at each level in the sched_domain hierarchy.
for_each_domain(cpu, sd) {
sg = sched_group_of(cpu)
energy_before = curr_util(sg) * busy_power(sg)
+ 1-curr_util(sg) * idle_power(sg)
energy_after = new_util(sg) * busy_power(sg)
+ 1-new_util(sg) * idle_power(sg)
energy_diff += energy_before - energy_after
}
The idle power estimate currently only supports a single idle state per
power (sub-)domain. Extending the support to multiple states requires a
way of predicting which states is going to be the most likely. This
prediction could be provided by cpuidle. Wake-ups energy is added later
in this series.
Assumptions and the basic algorithm are described in the code comments.
Signed-off-by:
Morten Rasmussen <morten.rasmussen@arm.com>
Loading
Please register or sign in to comment