sched/walt: Early Detect Boost Optimizations

Currently, if an ED task is detected on a cluster, the entire cluster's
frequency is raised to fmax. However, since ED tasks are only classified
under boosted scenarios anyways, this degree of boost may not be
necessary. This patch introduces a tunable, sched_ed_boost, which can be
used to boost the highest load on the cluster with an ED task by x%, x
being the set tunable.

Change-Id: I90ce6e7435b89ed27d307a164fdd7b8f6c8f5c9e
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2022-02-24 10:55:28 -08:00 committed by Sai Harshini Nimmala
parent f1b09a77f5
commit 1d077fe1d4
4 changed files with 25 additions and 7 deletions

View File

@ -296,8 +296,14 @@ static void waltgov_walt_adjust(struct waltgov_cpu *wg_cpu, unsigned long cpu_ut
bool is_migration = wg_cpu->flags & WALT_CPUFREQ_IC_MIGRATION;
bool is_rtg_boost = wg_cpu->walt_load.rtgb_active;
bool is_hiload;
bool is_ed_boost = wg_cpu->walt_load.ed_active;
unsigned long pl = wg_cpu->walt_load.pl;
if (is_ed_boost) {
cpu_util = mult_frac(cpu_util, 100 + sysctl_ed_boost_pct, 100);
max_and_reason(util, cpu_util, wg_cpu, CPUFREQ_REASON_EARLY_DET);
}
if (is_rtg_boost)
max_and_reason(util, wg_policy->rtg_boost_util, wg_cpu, CPUFREQ_REASON_RTG_BOOST);
@ -316,6 +322,9 @@ static void waltgov_walt_adjust(struct waltgov_cpu *wg_cpu, unsigned long cpu_ut
pl = mult_frac(pl, TARGET_LOAD, 100);
max_and_reason(util, pl, wg_cpu, CPUFREQ_REASON_PL);
}
if (is_ed_boost)
wg_cpu->reasons |= CPUFREQ_REASON_EARLY_DET;
}
static inline unsigned long target_util(struct waltgov_policy *wg_policy,

View File

@ -74,6 +74,7 @@ unsigned int sysctl_sched_asymcap_boost;
unsigned int sysctl_sched_long_running_rt_task_ms;
unsigned int sysctl_sched_idle_enough;
unsigned int sysctl_sched_cluster_util_thres_pct;
unsigned int sysctl_ed_boost_pct;
/* range is [1 .. INT_MAX] */
static int sysctl_task_read_pid = 1;
@ -922,6 +923,15 @@ struct ctl_table walt_table[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = &two_thousand,
},
{
.procname = "sched_ed_boost",
.data = &sysctl_ed_boost_pct,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = &one_hundred,
},
{ }
};

View File

@ -584,12 +584,6 @@ static inline u64 freq_policy_load(struct rq *rq, unsigned int *reason)
u64 load, tt_load = 0, kload = 0;
struct task_struct *cpu_ksoftirqd = per_cpu(ksoftirqd, cpu_of(rq));
if (wrq->ed_task != NULL) {
load = sched_ravg_window;
*reason = CPUFREQ_REASON_EARLY_DET;
goto done;
}
if (sched_freq_aggr_en) {
load = wrq->prev_runnable_sum + aggr_grp_load;
*reason = CPUFREQ_REASON_FREQ_AGR;
@ -621,7 +615,6 @@ static inline u64 freq_policy_load(struct rq *rq, unsigned int *reason)
*reason = CPUFREQ_REASON_SUH;
}
done:
trace_sched_load_to_gov(rq, aggr_grp_load, tt_load, sched_freq_aggr_en,
load, 0, walt_rotation_enabled,
sysctl_sched_user_hint, wrq, *reason);
@ -659,6 +652,10 @@ __cpu_util_freq_walt(int cpu, struct walt_cpu_load *walt_load, unsigned int *rea
walt_load->pl = pl;
walt_load->ws = walt_load_reported_window;
walt_load->rtgb_active = rtgb_active;
if (wrq->ed_task)
walt_load->ed_active = true;
else
walt_load->ed_active = false;
}
return (util >= capacity) ? capacity : util;

View File

@ -59,6 +59,7 @@ struct walt_cpu_load {
unsigned long pl;
bool rtgb_active;
u64 ws;
bool ed_active;
};
#define DECLARE_BITMAP_ARRAY(name, nr, bits) \
@ -216,6 +217,7 @@ extern unsigned int sysctl_sched_user_hint;
extern unsigned int sysctl_sched_conservative_pl;
extern unsigned int sysctl_sched_hyst_min_coloc_ns;
extern unsigned int sysctl_sched_long_running_rt_task_ms;
extern unsigned int sysctl_ed_boost_pct;
#define WALT_MANY_WAKEUP_DEFAULT 1000
extern unsigned int sysctl_sched_many_wakeup_threshold;