Re: [PATCH] sched_ext: introduce LLC awareness to the default idle selection policy

From: Tejun Heo
Date: Mon Oct 21 2024 - 16:01:45 EST


Hello,

Overall, I think this is a great idea.

On Mon, Oct 21, 2024 at 09:13:04AM +0200, Andrea Righi wrote:
...
> + /*
> + * Determine the task's LLC domain.
> + */
> + sd = rcu_dereference(per_cpu(sd_llc, prev_cpu));
> + if (sd)
> + cpumask_and(llc_cpus, sched_domain_span(sd), p->cpus_ptr);
> + else
> + cpumask_copy(llc_cpus, p->cpus_ptr);

However, I wonder whether we can be a bit more efficient here. Always
copying cpumasks can become noticeable in larger machines. It should be
possible to cover most common cases without copying cpumasks - e.g. tasks
which don't have any cpumask restrictions or affine within a single LLC
(including tasks restricted to one CPU) don't need to compute a new cpumask
each time. They can use either sched_domain_span() or p->cpus_ptr directly.

Thanks.

--
tejun