sched/fair: consider task utilization in group_max_util()
The group_max_util() function is used to compute the maximum utilization across the CPUs of a certain energy_env configuration. Its main client is the energy_diff function when it needs to compute the SG capacity for one of the before/after scheduling candidates. Currently, the energy_diff function sets util_delta = 0 when it wants to compute the energy corresponding to the scheduling candidate where the task runs in the previous CPU. This implies that, for the task waking up in the previous CPU we consider only its blocked load tracked by the CPU RQ. However, in case of a medium-big task which is waking up on a long time idle CPU, this blocked load can be already completely decayed. More in general, the current approach is biased towards under-estimating the capacity requirements for the "before" scheduling candidate. This patch fixes this by: - always use the cpu_util_wake() to properly get the utilization of a CPU without any (partially decayed) contribution of the waking up task - adding the task utilization to the cpu_util_wake just for the target cpu The "target CPU" is defined by the energy_env to be either the src_cpu or the dst_cpu, depending on which scheduling candidate we are considering. Finally, since this update removes the last usage of calc_util_delta() this function is now safely removed. Change-Id: I20ee1bcf40cee6bf6e265fb2d32ef79061ad6ced Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com> Signed-off-by: Chris Redpath <chris.redpath@arm.com>
This commit is contained in:
parent
5f8b3a757d
commit
3c71cbb896
1 changed files with 15 additions and 15 deletions
|
@ -5339,24 +5339,24 @@ static unsigned long __cpu_norm_util(unsigned long util, unsigned long capacity)
|
|||
return (util << SCHED_CAPACITY_SHIFT)/capacity;
|
||||
}
|
||||
|
||||
static int calc_util_delta(struct energy_env *eenv, int cpu)
|
||||
static unsigned long group_max_util(struct energy_env *eenv)
|
||||
{
|
||||
if (cpu == eenv->src_cpu)
|
||||
return -eenv->util_delta;
|
||||
if (cpu == eenv->dst_cpu)
|
||||
return eenv->util_delta;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
unsigned long group_max_util(struct energy_env *eenv)
|
||||
{
|
||||
int i, delta;
|
||||
unsigned long max_util = 0;
|
||||
unsigned long util;
|
||||
int cpu;
|
||||
|
||||
for_each_cpu(i, sched_group_cpus(eenv->sg_cap)) {
|
||||
delta = calc_util_delta(eenv, i);
|
||||
max_util = max(max_util, __cpu_util(i, delta));
|
||||
for_each_cpu(cpu, sched_group_cpus(eenv->sg_cap)) {
|
||||
util = cpu_util_wake(cpu, eenv->task);
|
||||
|
||||
/*
|
||||
* If we are looking at the target CPU specified by the eenv,
|
||||
* then we should add the (estimated) utilization of the task
|
||||
* assuming we will wake it up on that CPU.
|
||||
*/
|
||||
if (unlikely(cpu == eenv->trg_cpu))
|
||||
util += eenv->util_delta;
|
||||
|
||||
max_util = max(max_util, util);
|
||||
}
|
||||
|
||||
return max_util;
|
||||
|
|
Loading…
Add table
Reference in a new issue