summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@linaro.org>2017-09-15 08:25:32 +0800
committerJoel Fernandes <joelaf@google.com>2017-10-24 15:49:27 +0000
commit774481506a83d305353330e44b8e0f6ad80a34a8 (patch)
tree82de22c4b37270653e88901d3553de36dad50f31
parenta7e1d33c7a1101936cf7f048a0ef7cac62e32cd0 (diff)
cpufreq: schedutil: clamp util to CPU maximum capacity
The code is to get the CPU util by accumulate different scheduling classes and when the total util value is larger than CPU capacity then it clamps util to CPU maximum capacity. So we can get correct util value when use PELT signal but if with WALT signal it misses to clamp util value. On the other hand, WALT doesn't accumulate different class utilization but it needs to applying boost margin for WALT signal the CPU util value is possible to be larger than CPU capacity; so this patch is to always clamp util to CPU maximum capacity. Change-Id: I05481ddbf20246bb9be15b6bd21b6ec039015ea8 Signed-off-by: Leo Yan <leo.yan@linaro.org>
-rw-r--r--kernel/sched/cpufreq_schedutil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 28977799017b..d3765f0cb699 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -216,8 +216,9 @@ static void sugov_get_util(unsigned long *util, unsigned long *max, u64 time)
*util = boosted_cpu_util(cpu);
if (likely(use_pelt()))
- *util = min((*util + rt), max_cap);
+ *util = *util + rt;
+ *util = min(*util, max_cap);
*max = max_cap;
}