ANDROID: Add vendor hook to the effective_cpu_util

android_rvh_effective_cpu_util:
	To perform vendor-specific cpu util, it is used in EAS/schedutil/thermal.

The effective_cpu_util would be called when thermal calc the dynamic power,
it's non-atomic context, so set the hook be restricted.

Bug: 226686099
Test: build pass

Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Change-Id: I6fd77f44ca4328f5ef37d96989aa2e08d65e29bb
This commit is contained in:
Xuewen Yan 2022-03-25 10:08:13 +08:00 committed by Todd Kjos
parent 0c2142745d
commit 3be7d118e7
3 changed files with 12 additions and 0 deletions

View file

@ -370,6 +370,12 @@ DECLARE_HOOK(android_vh_dup_task_struct,
DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg,
TP_PROTO(struct sched_entity *se),
TP_ARGS(se), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_effective_cpu_util,
TP_PROTO(int cpu, unsigned long util_cfs, unsigned long max, int type,
struct task_struct *p, unsigned long *new_util),
TP_ARGS(cpu, util_cfs, max, type, p, new_util), 1);
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */

View file

@ -7374,9 +7374,14 @@ unsigned long effective_cpu_util(int cpu, unsigned long util_cfs,
{
unsigned long dl_util, util, irq, max;
struct rq *rq = cpu_rq(cpu);
unsigned long new_util = ULONG_MAX;
max = arch_scale_cpu_capacity(cpu);
trace_android_rvh_effective_cpu_util(cpu, util_cfs, max, type, p, &new_util);
if (new_util != ULONG_MAX)
return new_util;
if (!uclamp_is_used() &&
type == FREQUENCY_UTIL && rt_rq_is_runnable(&rq->rt)) {
return max;

View file

@ -95,3 +95,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_task_time);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dup_task_struct);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_irqtime_account_process_tick);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_effective_cpu_util);