[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-uIpnfjWq6LXSX7@gpd3>
Date: Tue, 1 Apr 2025 08:33:10 +0200
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
Joel Fernandes <joelagnelf@...dia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/6] sched_ext: idle: Accept an arbitrary cpumask in
scx_select_cpu_dfl()
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
Powered by blists - more mailing lists