From 0e1177f4889429f3dc09f2f862c44d583a10da1b Mon Sep 17 00:00:00 2001 From: maoshenshen Date: Fri, 12 Apr 2024 10:56:56 +0800 Subject: [PATCH] ANDROID: sched: add trace_android_vh_map_util_freq parameter Add "cpufreq_policy" and "need_freq_update" parameters to the vendor hook to enable frequency calculation in certain special cases related to OEM's frequency tuning policy. Bug: 183674818 Signed-off-by: lijianzhong Change-Id: I232d2e1ae885d6736eca9e4709870f4272b4873d Signed-off-by: maoshenshen Signed-off-by: Qixia Yang --- include/trace/hooks/sched.h | 6 ++++-- kernel/sched/cpufreq_schedutil.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 87e84bbac155..760f017220ce 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -436,10 +436,12 @@ DECLARE_HOOK(android_vh_account_task_time, TP_PROTO(struct task_struct *p, struct rq *rq, int user_tick), TP_ARGS(p, rq, user_tick)); +struct cpufreq_policy; 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)); + unsigned long cap, unsigned long *next_freq, struct cpufreq_policy *policy, + bool *need_freq_update), + TP_ARGS(util, freq, cap, next_freq, policy, need_freq_update)); DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_comm, TP_PROTO(struct task_struct *p, const struct cpumask *new_mask), diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index d6e1a9453fb7..df8200c8b3e7 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -178,7 +178,8 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, unsigned long next_freq = 0; freq = get_capacity_ref_freq(policy); - trace_android_vh_map_util_freq(util, freq, max, &next_freq); + trace_android_vh_map_util_freq(util, freq, max, &next_freq, policy, + &sg_policy->need_freq_update); if (next_freq) freq = next_freq; else