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 <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2022-03-09 10:23:12 -08:00 committed by Rishabh Bhatnagar
parent f9d4ca7937
commit 2201f39e1c

View File

@ -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;