[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b32a658d-27fd-4f61-8f6f-58fa71af30c8@arm.com>
Date: Wed, 19 Jun 2024 15:07:51 +0100
From: Christian Loehle <christian.loehle@....com>
To: Tejun Heo <tj@...nel.org>, rafael@...nel.org, viresh.kumar@...aro.org
Cc: linux-pm@...r.kernel.org, void@...ifault.com,
linux-kernel@...r.kernel.org, kernel-team@...a.com, mingo@...hat.com,
peterz@...radead.org, David Vernet <dvernet@...a.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH 2/2] sched_ext: Add cpuperf support
On 6/19/24 04:12, Tejun Heo wrote:
> sched_ext currently does not integrate with schedutil. When schedutil is the
> governor, frequencies are left unregulated and usually get stuck close to
> the highest performance level from running RT tasks.
>
> Add CPU performance monitoring and scaling support by integrating into
> schedutil. The following kfuncs are added:
>
> - scx_bpf_cpuperf_cap(): Query the relative performance capacity of
> different CPUs in the system.
>
> - scx_bpf_cpuperf_cur(): Query the current performance level of a CPU
> relative to its max performance.
>
> - scx_bpf_cpuperf_set(): Set the current target performance level of a CPU.
>
> This gives direct control over CPU performance setting to the BPF scheduler.
> The only changes on the schedutil side are accounting for the utilization
> factor from sched_ext and disabling frequency holding heuristics as it may
> not apply well to sched_ext schedulers which may have a lot weaker
> connection between tasks and their current / last CPU.
>
> With cpuperf support added, there is no reason to block uclamp. Enable while
> at it.
>
> A toy implementation of cpuperf is added to scx_qmap as a demonstration of
> the feature.
>
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Reviewed-by: David Vernet <dvernet@...a.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> Cc: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> kernel/sched/cpufreq_schedutil.c | 12 +-
> kernel/sched/ext.c | 83 ++++++++++++-
> kernel/sched/ext.h | 9 ++
> kernel/sched/sched.h | 1 +
> tools/sched_ext/include/scx/common.bpf.h | 3 +
> tools/sched_ext/scx_qmap.bpf.c | 142 ++++++++++++++++++++++-
> tools/sched_ext/scx_qmap.c | 8 ++
> 7 files changed, 252 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 972b7dd65af2..12174c0137a5 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -197,7 +197,9 @@ unsigned long sugov_effective_cpu_perf(int cpu, unsigned long actual,
>
> static void sugov_get_util(struct sugov_cpu *sg_cpu, unsigned long boost)
> {
> - unsigned long min, max, util = cpu_util_cfs_boost(sg_cpu->cpu);
> + unsigned long min, max;
> + unsigned long util = cpu_util_cfs_boost(sg_cpu->cpu) +
> + scx_cpuperf_target(sg_cpu->cpu);
What does cpu_util_cfs_boost() contain if scx is active?
NIT: reverse xmas
>
> util = effective_cpu_util(sg_cpu->cpu, util, &min, &max);
> util = max(util, boost);
> @@ -330,6 +332,14 @@ static bool sugov_hold_freq(struct sugov_cpu *sg_cpu)
> unsigned long idle_calls;
> bool ret;
>
> + /*
> + * The heuristics in this function is for the fair class. For SCX, the
> + * performance target comes directly from the BPF scheduler. Let's just
> + * follow it.
> + */
> + if (scx_switched_all())
> + return false;
> +
> [SNIP]
Powered by blists - more mailing lists