diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index d95612b7d29a..07f21f88e2a2 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -67,3 +67,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_regs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wq_lockup_pool); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq); diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index a2f5b45dd6f9..61d926289438 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -70,6 +70,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_group, TP_PROTO(struct sched_group *busiest, struct rq *dst_rq, int *out_balance), TP_ARGS(busiest, dst_rq, out_balance), 1); +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 7fbaee24c824..9b8e29b39f54 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -12,6 +12,7 @@ #include #include +#include #define IOWAIT_BOOST_MIN (SCHED_CAPACITY_SCALE / 8) @@ -172,8 +173,13 @@ 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; - 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;