On Wed, Sep 08, 2021 at 08:59:36AM -0700, Linus Torvalds wrote:
On Wed, Sep 8, 2021 at 3:03 AM Wei Liu wei.liu@kernel.org wrote:
Thanks for the heads-up. I found one instance of this bad practice in hv_apic.c. Presumably that's the one you were referring to.
Yeah, that must have been the one I saw.
However calling into the allocator from that IPI path seems very heavy weight. I will discuss with fellow engineers on how to fix it properly.
In other places, the options have been fairly straightforward:
(a) avoid the allocation entirely.
I think the main reason hyperv does it is because it wants to clear the "current cpu" from the cpumask for the ALL_BUT_SELF case, and if you can just instead keep track of that "all but self" bit separately and pass it down the call chain, you may not need that allocation at all.
[..]
That said, if you are already just iterating over the mask, doing (a) may be trivial. No allocation at all is even better than a percpu one.
Yep. I just wrote two patches for this approach.
Wei.