RE: [PATCH v4 1/2] x86/resctrl: Pass domain to target CPU

From: Luck, Tony
Date: Fri Mar 08 2024 - 13:51:00 EST


> > + hw_dom->ctrl_val[idx] = cfg->new_ctrl;
> > + cpu = cpumask_any(&d->cpu_mask);
>
> If this CPU is part of the domain, then cpumask_any() could chose a different CPU leading
> to an IPI, where this CPU could have done the work itself.
> smp_call_function_any() has the logic to try and run on this CPU if possible.
>
> As d->cpu_mask is still valid when you call smp_call_function_single(), could we use
> smp_call_function_any() instead?

I'd thought that cpumask_any() was smarter. But I see that it dumbly just picks the first
CPU in the mask. Great suggestion, will add to next version.

>> - cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
>> + cpu = cpumask_any(&d->cpu_mask);
>
> Same comment about picking an unlucky CPU here, smp_call_function_any() can improve our
> chances.

Will fix here too.

> Still:
> Reviewed-by: James Morse <james.morse@xxxxxxx>

Thanks!

-Tony