ANDROID: sched: add em_pd_energy vendor hook

We add a vendor hook for util to freq calculation in schedutil,
so we need to do corresponding change for energy calculation.

android_vh_em_pd_energy
	adjust energy calculation

Bug: 178021064

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: Iae772cf07881602eea3f27aeb75fba753e7c2635
This commit is contained in:
Yun Hsiang 2021-01-14 13:47:38 +08:00
commit b7f31af2f1
3 changed files with 14 additions and 1 deletions

View file

@ -68,3 +68,4 @@ 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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_pd_energy);

View file

@ -75,6 +75,13 @@ DECLARE_HOOK(android_vh_map_util_freq,
unsigned long cap, unsigned long *next_freq),
TP_ARGS(util, freq, cap, next_freq));
struct em_perf_domain;
DECLARE_HOOK(android_vh_em_pd_energy,
TP_PROTO(struct em_perf_domain *pd,
unsigned long max_util, unsigned long sum_util,
unsigned long *energy),
TP_ARGS(pd, max_util, sum_util, energy));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */

View file

@ -6340,6 +6340,7 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd)
struct cpumask *pd_mask = perf_domain_span(pd);
unsigned long cpu_cap = arch_scale_cpu_capacity(cpumask_first(pd_mask));
unsigned long max_util = 0, sum_util = 0;
unsigned long energy = 0;
int cpu;
/*
@ -6376,7 +6377,11 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd)
max_util = max(max_util, cpu_util);
}
return em_pd_energy(pd->em_pd, max_util, sum_util);
trace_android_vh_em_pd_energy(pd->em_pd, max_util, sum_util, &energy);
if (!energy)
energy = em_pd_energy(pd->em_pd, max_util, sum_util);
return energy;
}
/*