summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorChris Redpath <chris.redpath@arm.com>2017-03-24 17:37:28 +0000
committerAndres Oportus <andresoportus@google.com>2017-06-02 08:01:55 -0700
commit4c031f0e6fbc0fcea864836356c77b3aa0b29947 (patch)
tree178b17a8b46962b4e6ec9deb27c33fd5490980af /kernel
parentfc969e3bfa7aaaee77d91c55807ee5a8c6a26b73 (diff)
cpufreq/schedutil: use boosted_cpu_util for PELT to match WALT
When using WALT we always used boosted cpu util for OPP selection. This is the primary purpose for boosted cpu util, but we hadn't changed the PELT utilization check to do the same thing. Fix that here. Change-Id: Id5ffb26eac23b25fe754255221f6d21b8cededfd Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com> Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/cpufreq_schedutil.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 191ba36a9eeb..75bfbb336722 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -19,9 +19,7 @@
#include "sched.h"
#include "tune.h"
-#ifdef CONFIG_SCHED_WALT
unsigned long boosted_cpu_util(int cpu);
-#endif
/* Stub out fast switch routines present on mainline to reduce the backport
* overhead. */
@@ -188,6 +186,15 @@ static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util,
return cpufreq_driver_resolve_freq(policy, freq);
}
+static inline bool use_pelt(void)
+{
+#ifdef CONFIG_SCHED_WALT
+ return (!sysctl_sched_use_walt_cpu_util || walt_disabled);
+#else
+ return true;
+#endif
+}
+
static void sugov_get_util(unsigned long *util, unsigned long *max, u64 time)
{
int cpu = smp_processor_id();
@@ -204,11 +211,10 @@ static void sugov_get_util(unsigned long *util, unsigned long *max, u64 time)
rt = div64_u64(rq->rt_avg, sched_avg_period() + delta);
rt = (rt * max_cap) >> SCHED_CAPACITY_SHIFT;
- *util = min(rq->cfs.avg.util_avg + rt, max_cap);
-#ifdef CONFIG_SCHED_WALT
- if (!walt_disabled && sysctl_sched_use_walt_cpu_util)
- *util = boosted_cpu_util(cpu);
-#endif
+ *util = boosted_cpu_util(cpu);
+ if (likely(use_pelt()))
+ *util = min((*util + rt), max_cap);
+
*max = max_cap;
}