From cfb4162ea3a57bd32bf1eb62affc4555123e5fde Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 16 Jun 2021 17:53:24 -0700 Subject: [PATCH] sched: walt: Fix max_util calculation When calculating max_util for energy evaluations, we adjust the util on the basis of frequency, using arch_scale_freq_capacity. However, the return value is scaled to 1024 and not to the capacity of the CPU. Change-Id: I214ac4b40b88105147c2e5dcc350ff1601496d4c Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/walt_cfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 0839c90c72bb..7e7649337611 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -516,7 +516,9 @@ static inline unsigned long walt_em_cpu_energy(struct em_perf_domain *pd, scale_cpu = arch_scale_cpu_capacity(cpu); max_util = max_util + (max_util >> 2); /* account for TARGET_LOAD usually 80 */ - max_util = max(max_util, arch_scale_freq_capacity(cpu)); + max_util = max(max_util, + (arch_scale_freq_capacity(cpu) * capacity_orig_of(cpu)) >> + SCHED_CAPACITY_SHIFT); /* * The capacity of a CPU in the domain at the performance state (ps)