ANDROID: schedutil: add vendor hook for adjusting util to freq calculation

Currently, the frequency is calculated by max freq * 1.25 * util / max cap.
Add a vendor hook to adjust the frequency when the calculation
overestimate.

android_vh_map_util_freq
	adjust util to freq calculation

Bug: 177845439

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I9aa9079f00af7d3380b19f2fe21b75cddd107d15
Signed-off-by: shenshen mao <maoshenshen@oppo.com>
Signed-off-by: Qixia Yang <yangqixia2@oppo.com>
This commit is contained in:
Yun Hsiang
2021-01-13 17:00:22 +08:00
committed by Treehugger Robot
parent de121bf8fb
commit b5970c5c58
3 changed files with 13 additions and 1 deletions
+6
View File
@@ -404,6 +404,12 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_load_avg_cfs_rq,
DECLARE_RESTRICTED_HOOK(android_rvh_update_rt_rq_load_avg_internal,
TP_PROTO(u64 now, struct rq *rq, int running, int *ret),
TP_ARGS(now, rq, running, ret), 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 */
+6 -1
View File
@@ -175,9 +175,14 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
{
struct cpufreq_policy *policy = sg_policy->policy;
unsigned int freq;
unsigned long next_freq = 0;
freq = get_capacity_ref_freq(policy);
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;
+1
View File
@@ -105,3 +105,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_blocked_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg_cfs_rq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg_internal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);