From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] sched_ext: idle: Accept an arbitrary cpumask in scx_select_cpu_dfl()
Date: Tue, 1 Apr 2025 08:33:10 +0200 [thread overview]
Message-ID: <Z-uIpnfjWq6LXSX7@gpd3> (raw)
In-Reply-To: <Z-sPlB3ih10SS9w0@slm.duckdns.org>
On Mon, Mar 31, 2025 at 11:56:36AM -1000, Tejun Heo wrote:
> On Fri, Mar 21, 2025 at 11:10:49PM +0100, Andrea Righi wrote:
> ...
> > + /*
> > + * If @prev_cpu is not in the allowed domain, try to assign a new
> > + * arbitrary CPU usable by the task in the allowed domain.
> > + */
> > + if (!cpumask_test_cpu(prev_cpu, allowed)) {
> > + cpu = cpumask_any_and_distribute(p->cpus_ptr, allowed);
> > + if (cpu < nr_cpu_ids) {
> > + prev_cpu = cpu;
> > + } else {
> > + cpu = -EBUSY;
> > + goto out_enable;
> > + }
> > + }
>
> Would it be better to clear it to -1 and disable @prev_cpu optimizations if
> negative? Not a big deal, so please feel free to push back but things like
> wake_sync optimization become a bit weird with @prev_cpu set to some random
> CPU and down the line if we want to allow e.g. preferring previous idle CPU
> even when the sibling CPU isn't idle which seems to help with some
> workloads, this can become tricky.
Maybe a better strategy would be to try with prev_cpu = smp_processor_id(),
if it's in the subset p->cpus_ptr & allowed, which might be beneficial for
some waker->wakee scenarios, otherwise jump directly to the end, with
cpu = scx_pick_idle_cpu(allowed, node, flags).
Thanks,
-Andrea
next prev parent reply other threads:[~2025-04-01 6:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 22:10 [PATCHSET v6 sched_ext/for-6.15] sched_ext: Enhance built-in idle selection with allowed CPUs Andrea Righi
2025-03-21 22:10 ` [PATCH 1/6] sched_ext: idle: Extend topology optimizations to all tasks Andrea Righi
2025-03-21 22:10 ` [PATCH 2/6] sched_ext: idle: Explicitly pass allowed cpumask to scx_select_cpu_dfl() Andrea Righi
2025-03-31 21:50 ` Tejun Heo
2025-04-01 6:21 ` Andrea Righi
2025-03-21 22:10 ` [PATCH 3/6] sched_ext: idle: Accept an arbitrary cpumask in scx_select_cpu_dfl() Andrea Righi
2025-03-31 21:56 ` Tejun Heo
2025-04-01 6:33 ` Andrea Righi [this message]
2025-03-21 22:10 ` [PATCH 4/6] sched_ext: idle: Introduce scx_bpf_select_cpu_and() Andrea Righi
2025-03-31 21:59 ` Tejun Heo
2025-04-01 6:35 ` Andrea Righi
2025-03-21 22:10 ` [PATCH 5/6] selftests/sched_ext: Add test for scx_bpf_select_cpu_and() Andrea Righi
2025-03-21 22:10 ` [PATCH 6/6] sched_ext: idle: Deprecate scx_bpf_select_cpu_dfl() Andrea Righi
2025-03-31 22:01 ` Tejun Heo
2025-04-01 6:38 ` Andrea Righi
2025-03-22 3:56 ` [PATCHSET v6 sched_ext/for-6.15] sched_ext: Enhance built-in idle selection with allowed CPUs Changwoo Min
-- strict thread matches above, loose matches on Subject: below --
2025-03-20 7:36 [PATCHSET v5 " Andrea Righi
2025-03-20 7:36 ` [PATCH 3/6] sched_ext: idle: Accept an arbitrary cpumask in scx_select_cpu_dfl() Andrea Righi
2025-03-17 17:53 [PATCHSET v4 sched_ext/for-6.15] sched_ext: Enhance built-in idle selection with allowed CPUs Andrea Righi
2025-03-17 17:53 ` [PATCH 3/6] sched_ext: idle: Accept an arbitrary cpumask in scx_select_cpu_dfl() Andrea Righi
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=Z-uIpnfjWq6LXSX7@gpd3 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.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