Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68ecddcd authored by Yun Hsiang's avatar Yun Hsiang Committed by Todd Kjos
Browse files

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: 177845438

Signed-off-by: default avatarYun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I9aa9079f00af7d3380b19f2fe21b75cddd107d15
parent 247d907f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+5 −0
Original line number Diff line number Diff line
@@ -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 */
+7 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@

#include <linux/sched/cpufreq.h>
#include <trace/events/power.h>
#include <trace/hooks/sched.h>

#define IOWAIT_BOOST_MIN	(SCHED_CAPACITY_SCALE / 8)

@@ -172,7 +173,12 @@ 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;

	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)