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

From: Andrea Righi
Date: Tue Oct 22 2024 - 01:34:28 EST


On Mon, Oct 21, 2024 at 10:01:27AM -1000, Tejun Heo wrote:
> External email: Use caution opening links or attachments
>
>
> 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.

I agree, I was also thinking to improve this part to avoid doing the
copy. And I have a few other changes to apply, I'll send a v2 soon.

Thanks!
-Andrea

>
> Thanks.
>
> --
> tejun