From 2201f39e1cc7bba8b0733ae122293afc47b380ca Mon Sep 17 00:00:00 2001 From: Shaleen Agrawal Date: Wed, 9 Mar 2022 10:23:12 -0800 Subject: [PATCH] sched/walt: Fix setting RTG Boost Freq Currently the tunable to set RTG Boost Frequency is set on the basis of a hardcoded policy->cpu. However, this is incorrect on two fronts - first, CPU4 is no longer the default CPU managing the Gold CPU policy (it is now CPU3). Secondly, the "typical" CPU managing the cluster's policy cpu may be offline, in which case, another CPU from the cluster would be managing the policy, and this implementation would break. Change-Id: I0b9d4b882c93f48ea73f4cfa20e547d4216e142c Signed-off-by: Shaleen Agrawal --- kernel/sched/walt/cpufreq_walt.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/kernel/sched/walt/cpufreq_walt.c b/kernel/sched/walt/cpufreq_walt.c index d05b38c4890a..fa8b913bb2d6 100644 --- a/kernel/sched/walt/cpufreq_walt.c +++ b/kernel/sched/walt/cpufreq_walt.c @@ -265,9 +265,9 @@ static unsigned long waltgov_get_util(struct waltgov_cpu *wg_cpu) #define NL_RATIO 75 #define DEFAULT_HISPEED_LOAD 90 -#define DEFAULT_CPU0_RTG_BOOST_FREQ 1000000 -#define DEFAULT_CPU4_RTG_BOOST_FREQ 768000 -#define DEFAULT_CPU7_RTG_BOOST_FREQ 0 +#define DEFAULT_SILVER_RTG_BOOST_FREQ 1000000 +#define DEFAULT_GOLD_RTG_BOOST_FREQ 768000 +#define DEFAULT_PRIME_RTG_BOOST_FREQ 0 #define DEFAULT_TARGET_LOAD_THRESH 1024 #define DEFAULT_TARGET_LOAD_SHIFT 4 static void waltgov_walt_adjust(struct waltgov_cpu *wg_cpu, unsigned long cpu_util, @@ -856,18 +856,12 @@ static int waltgov_init(struct cpufreq_policy *policy) tunables->target_load_thresh = DEFAULT_TARGET_LOAD_THRESH; tunables->target_load_shift = DEFAULT_TARGET_LOAD_SHIFT; - switch (policy->cpu) { - default: - case 0: - tunables->rtg_boost_freq = DEFAULT_CPU0_RTG_BOOST_FREQ; - break; - case 4: - tunables->rtg_boost_freq = DEFAULT_CPU4_RTG_BOOST_FREQ; - break; - case 7: - tunables->rtg_boost_freq = DEFAULT_CPU7_RTG_BOOST_FREQ; - break; - } + if (is_min_cluster_cpu(policy->cpu)) + tunables->rtg_boost_freq = DEFAULT_SILVER_RTG_BOOST_FREQ; + else if (is_max_cluster_cpu(policy->cpu)) + tunables->rtg_boost_freq = DEFAULT_PRIME_RTG_BOOST_FREQ; + else + tunables->rtg_boost_freq = DEFAULT_GOLD_RTG_BOOST_FREQ; policy->governor_data = wg_policy; wg_policy->tunables = tunables;