Re: [RFC 2/4] sched/numa: replace runnable_load_avg by load_avg

From: Mel Gorman
Date: Wed Feb 12 2020 - 11:04:39 EST


On Wed, Feb 12, 2020 at 04:03:28PM +0100, Vincent Guittot wrote:
> > Ok, so this is essentially group_is_overloaded.
> >
> >
> > > + if ((ns->nr_running < ns->weight) ||
> > > + ((ns->compute_capacity * 100) > (ns->util * imbalance_pct)))
> > > + return node_has_spare;
> > > +
> >
> > And this is group_has_capacity. What I did was have a common helper
> > for both NUMA and normal load balancing and translated the fields from
> > sg_lb_stats and numa_stats into a common helper. This is to prevent them
> > getting out of sync. The conversion was incomplete in my case but in
> > principle, both NUMA and CPU load balancing should use common helpers or
> > they'll get out of sync.
>
> I fact, I wanted to keep this patch simple and readable for the 1st
> version in order to not afraid people from reviewing it. That's the
> main reason I didn't merge it with load_balance but i agree that some
> common helper function might be possible.
>

Makes sense.

> Also the struct sg_lb_stats has a lot more fields compared to struct numa_stats
>

Yes, I considered reusing the same structure and decided against it. I
simply created a common helper. It's trivial enough to do on top after
the fact in the name of clarity. Fundamentally it's cosmetic.

> Then, I wonder if we could end up with different rules for numa like
> taking into account some NUMA specifics metrics to classify the node
>

Well, we could but right now they should be the same. As it is, the NUMA
balancer and load balancer overrule each other. I think the scope for
changing that without causing regressions is limited.

--
Mel Gorman
SUSE Labs