Re: [PATCH net-next V2 2/2] net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints

Peter Zijlstra
2022-07-18T21:25:45Z

On Mon, Jul 18, 2022 at 10:49:21PM +0300, Tariq Toukan wrote:

> > > + first = cpumask_local_spread(0, dev->priv.numa_node);
> >
> > Arguably you want something like:
> >
> > first = cpumask_any(cpumask_of_node(dev->priv.numa_node));
>
> Any doesn't sound like what I'm looking for, I'm looking for first.
> I do care about the order within the node, so it's more like
> cpumask_first(cpumask_of_node(dev->priv.numa_node));
>
> Do you think this has any advantage over cpumask_local_spread, if used only
> during the setup phase of the driver?

Only for the poor sod trying to read this code ;-) That is, I had no
idea what cpumask_local_spread() does, while cpumask_first() is fairly
obvious.

> > > @@ -830,8 +887,7 @@ static int comp_irqs_request(struct mlx5_core_dev *dev)
> > > ret = -ENOMEM;
> > > goto free_irqs;
> > > }
> > > - for (i = 0; i < ncomp_eqs; i++)
> > > - cpus[i] = cpumask_local_spread(i, dev->priv.numa_node);
> > > + mlx5_set_eqs_cpus(dev, cpus, ncomp_eqs);
> >
> > So you change this for mlx5, what about the other users of
> > cpumask_local_spread() ?
>
> I took a look at the different netdev users.
> While some users have similar use case to ours (affinity hints), many others
> use cpumask_local_spread in other flows (XPS setting, ring allocations,
> etc..).
>
> Moving them to use the newly exposed API needs some deeper dive into their
> code, especially due to the possible undesired side-effects.
>
> I prefer not to include these changes in my series for now, but probably
> contribute it in a followup work.

Fair enough.