diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index ae4aa902df1c..ca5b7dd6a595 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -332,6 +332,11 @@ DECLARE_HOOK(android_vh_sched_pelt_multiplier, TP_PROTO(unsigned int old, unsigned int cur, int *ret), TP_ARGS(old, cur, ret)); +DECLARE_HOOK(android_vh_map_util_freq, + TP_PROTO(unsigned long util, unsigned long freq, + unsigned long cap, unsigned long *next_freq), + TP_ARGS(util, freq, cap, next_freq)); + /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_SCHED_H */ diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 919f8e9a04d7..155adf154196 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -6,6 +6,8 @@ * Author: Rafael J. Wysocki */ +#include + #define IOWAIT_BOOST_MIN (SCHED_CAPACITY_SCALE / 8) struct sugov_tunables { @@ -143,9 +145,14 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, struct cpufreq_policy *policy = sg_policy->policy; unsigned int freq = arch_scale_freq_invariant() ? policy->cpuinfo.max_freq : policy->cur; + unsigned long next_freq = 0; util = map_util_perf(util); - freq = map_util_freq(util, freq, max); + trace_android_vh_map_util_freq(util, freq, max, &next_freq); + if (next_freq) + freq = next_freq; + else + freq = map_util_freq(util, freq, max); if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) return sg_policy->next_freq; diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 5df92650244a..98c99358223e 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -86,3 +86,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_new_ilb); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_energy_efficient_cpu); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_pelt_multiplier); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);