From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8] sched_ext: idle: Refresh idle masks during idle-to-idle transitions
Date: Fri, 10 Jan 2025 12:44:17 -1000 [thread overview]
Message-ID: <Z4GiwRDrRVmr7kSR@slm.duckdns.org> (raw)
In-Reply-To: <20250110221631.52262-1-arighi@nvidia.com>
On Fri, Jan 10, 2025 at 11:16:31PM +0100, Andrea Righi wrote:
> With the consolidation of put_prev_task/set_next_task(), see
> commit 436f3eed5c69 ("sched: Combine the last put_prev_task() and the
> first set_next_task()"), we are now skipping the transition between
> these two functions when the previous and the next tasks are the same.
>
> As a result, the scx idle state of a CPU is updated only when
> transitioning to or from the idle thread. While this is generally
> correct, it can lead to uneven and inefficient core utilization in
> certain scenarios [1].
>
> A typical scenario involves proactive wake-ups: scx_bpf_pick_idle_cpu()
> selects and marks an idle CPU as busy, followed by a wake-up via
> scx_bpf_kick_cpu(), without dispatching any tasks. In this case, the CPU
> continues running the idle thread, returns to idle, but remains marked
> as busy, preventing it from being selected again as an idle CPU (until a
> task eventually runs on it and releases the CPU).
>
> For example, running a workload that uses 20% of each CPU, combined with
> an scx scheduler using proactive wake-ups, results in the following core
> utilization:
>
> CPU 0: 25.7%
> CPU 1: 29.3%
> CPU 2: 26.5%
> CPU 3: 25.5%
> CPU 4: 0.0%
> CPU 5: 25.5%
> CPU 6: 0.0%
> CPU 7: 10.5%
>
> To address this, refresh the idle state also in pick_task_idle(), during
> idle-to-idle transitions, but only trigger ops.update_idle() on actual
> state changes to prevent unnecessary updates to the scx scheduler and
> maintain balanced state transitions.
>
> With this change in place, the core utilization in the previous example
> becomes the following:
>
> CPU 0: 18.8%
> CPU 1: 19.4%
> CPU 2: 18.0%
> CPU 3: 18.7%
> CPU 4: 19.3%
> CPU 5: 18.9%
> CPU 6: 18.7%
> CPU 7: 19.3%
>
> [1] https://github.com/sched-ext/scx/pull/1139
>
> Fixes: 7c65ae81ea86 ("sched_ext: Don't call put_prev_task_scx() before picking the next task")
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
Applied to sched_ext/for-6.13-fixes.
Thanks.
--
tejun
prev parent reply other threads:[~2025-01-10 22:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 22:16 Andrea Righi
2025-01-10 22:44 ` Tejun Heo [this message]
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=Z4GiwRDrRVmr7kSR@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--cc=vschneid@redhat.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
all inboxes | Powered by JetHome®