From: Christian Loehle <christian.loehle@arm.com>
To: Tejun Heo <tj@kernel.org>, rafael@kernel.org, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, void@manifault.com,
linux-kernel@vger.kernel.org, kernel-team@meta.com,
mingo@redhat.com, peterz@infradead.org,
David Vernet <dvernet@meta.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH 2/2] sched_ext: Add cpuperf support
Date: Wed, 19 Jun 2024 15:07:51 +0100 [thread overview]
Message-ID: <b32a658d-27fd-4f61-8f6f-58fa71af30c8@arm.com> (raw)
In-Reply-To: <20240619031250.2936087-3-tj@kernel.org>
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@kernel.org>
> Reviewed-by: David Vernet <dvernet@meta.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.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]
next prev parent reply other threads:[~2024-06-19 14:07 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 3:12 [PATCHSET sched_ext/for-6.11] sched_ext: Integrate with schedutil Tejun Heo
2024-06-19 3:12 ` [PATCH 1/2] cpufreq_schedutil: Refactor sugov_cpu_is_busy() Tejun Heo
2024-06-19 14:07 ` Christian Loehle
2024-06-19 18:57 ` Tejun Heo
2024-06-19 19:07 ` Tejun Heo
2024-06-20 9:40 ` Christian Loehle
2024-06-19 18:45 ` Rafael J. Wysocki
2024-06-19 19:53 ` Tejun Heo
2024-06-20 17:57 ` Rafael J. Wysocki
2024-06-20 18:08 ` Tejun Heo
2024-06-21 22:38 ` Tejun Heo
2024-06-19 3:12 ` [PATCH 2/2] sched_ext: Add cpuperf support Tejun Heo
2024-06-19 14:07 ` Christian Loehle [this message]
2024-06-19 19:19 ` Tejun Heo
2024-06-19 19:51 ` [PATCH v2 " Tejun Heo
2024-06-21 22:39 ` Tejun Heo
2024-07-05 12:41 ` Vincent Guittot
2024-07-05 18:22 ` Tejun Heo
2024-07-06 9:01 ` Vincent Guittot
2024-07-07 1:44 ` Tejun Heo
2024-07-08 6:37 ` Vincent Guittot
2024-07-08 18:20 ` Tejun Heo
2024-07-08 19:51 ` Vincent Guittot
2024-07-08 21:08 ` Tejun Heo
2024-07-09 13:36 ` Vincent Guittot
2024-07-09 16:43 ` Tejun Heo
2024-07-12 10:12 ` Vincent Guittot
2024-07-12 17:10 ` Tejun Heo
2024-07-02 10:23 ` [PATCH " Hongyan Xia
2024-07-02 16:37 ` Tejun Heo
2024-07-02 17:12 ` Hongyan Xia
2024-07-02 17:56 ` Tejun Heo
2024-07-02 20:41 ` Hongyan Xia
2024-07-02 21:12 ` Tejun Heo
2024-07-24 23:45 ` Qais Yousef
2024-07-31 1:05 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b32a658d-27fd-4f61-8f6f-58fa71af30c8@arm.com \
--to=christian.loehle@arm.com \
--cc=dvernet@meta.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=tj@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=void@manifault.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome