Energy calculation misses to consider RT/DL pressure for two factors. The first one factor is in function group_max_util() which calculates the CPU capacity index, if we ignore RT/DL pressure then may estimate the wrong capacity index value. The second factor is in function group_norm_util() which calculate the CPU busy/idle percentage, this part have totally ignored the energy introduced by RT/DL threads.
This commit considers RT/DL pressure for energy calculation by using __cpu_util_sum() to accumulate RT/DL and CFS utilization for both group_max_util() and group_norm_util().
Signed-off-by: Leo Yan leo.yan@linaro.org --- kernel/sched/fair.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1ce700a..f7a767d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5440,6 +5440,7 @@ static unsigned long group_max_util(struct energy_env *eenv, int cpu_idx) }
util += schedtune_margin(util, boost); + util = __cpu_util_sum(cpu, cpu_rq(cpu)->rt.avg.util_avg, util); max_util = max(max_util, util); }
@@ -5478,6 +5479,7 @@ long group_norm_util(struct energy_env *eenv, int cpu_idx) if (unlikely(cpu == eenv->cpu[cpu_idx].cpu_id)) util += eenv->util_delta;
+ util = __cpu_util_sum(cpu, cpu_rq(cpu)->rt.avg.util_avg, util); util_sum += __cpu_norm_util(util, capacity); }
-- 1.9.1