Re: [PATCH v6 4/8] padata: dispatch works on different nodes

From: Daniel Jordan
Date: Fri Mar 08 2024 - 10:43:19 EST


Hello Gang,

On Tue, Mar 05, 2024 at 10:49:47AM +0800, Gang Li wrote:
> On 2024/2/28 05:24, Daniel Jordan wrote:
> > On Thu, Feb 22, 2024 at 10:04:17PM +0800, Gang Li wrote:
> > > @@ -517,7 +518,16 @@ void __init padata_do_multithreaded(struct padata_mt_job *job)
> > > ps.chunk_size = roundup(ps.chunk_size, job->align);
> > > list_for_each_entry(pw, &works, pw_list)
> > > - queue_work(system_unbound_wq, &pw->pw_work);
> > > + if (job->numa_aware) {
> > > + int old_node = atomic_read(&last_used_nid);
> > > +
> > > + do {
> > > + nid = next_node_in(old_node, node_states[N_CPU]);
> > > + } while (!atomic_try_cmpxchg(&last_used_nid, &old_node, nid));
> >
> > There aren't concurrent NUMA-aware _do_multithreaded calls now, so an
> > atomic per work seems like an unnecessary expense for guarding against
>
> Hi Daniel,
>
> Yes, this is not necessary. But I think this operation is infrequent, so
> the burden shouldn't be too great?

I can only guess, but I bet you're right. It's also that people might
wonder what the atomic guards against, so non-atomic would make the code
a bit easier to understand. Either way, looks fine.

Acked-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>