Re: [PATCH v2 sched_ext/for-6.13] sched_ext: Do not enable LLC/NUMA optimizations when domains overlap

From: Andrea Righi
Date: Thu Nov 07 2024 - 16:37:31 EST


On Thu, Nov 07, 2024 at 09:14:07PM +0100, Andrea Righi wrote:
> On Thu, Nov 07, 2024 at 09:04:56AM -1000, Tejun Heo wrote:
> > Hello, Andrea.
> >
> > Some nits below:
> >
> > On Thu, Nov 07, 2024 at 09:48:03AM +0100, Andrea Righi wrote:
> > > +static bool llc_and_numa_mismatch(void)
> > > +{
> > ...
> > > + for_each_online_cpu(cpu) {
> > > + sd = cpu_rq(cpu)->sd;
> > > +
> > > + while (sd) {
> >
> > This can be for_each_domain(cpu, sd).
>
> Oh that's nicer, thanks!
>
> >
> > > + bool is_llc = sd->flags & SD_SHARE_LLC;
> > > + bool is_numa = sd->flags & SD_NUMA;
> > > +
> > > + if (is_llc != is_numa)
> > > + return true;
> > > +
> > > + sd = sd->parent;
> > > + }
> > > + }
> > > +
> > > + return false;
> > > +}

Actually the logic here is not correct at all, because it's inspecting
also the sd of SMT CPUs for example, so it will end up enabling NUMA
when it's not needed. I'll rethink this part.

-Andrea