Re: [PATCH V2] cpu/hotplug: Cache number of online CPUs

From: Thomas Gleixner
Date: Mon Jul 08 2019 - 10:20:14 EST


On Mon, 8 Jul 2019, Paul E. McKenney wrote:

> On Mon, Jul 08, 2019 at 03:43:55PM +0200, Thomas Gleixner wrote:
> > Revaluating the bitmap wheight of the online cpus bitmap in every
>
> s/wheight/weight/?
>
> > invocation of num_online_cpus() over and over is a pretty useless
> > exercise. Especially when num_online_cpus() is used in code pathes like the
> > IPI delivery of x86 or the membarrier code.
> >
> > Cache the number of online CPUs in the core and just return the cached
> > variable.
>
> I do like this and the comments on limited guarantees make sense.
> One suggestion for saving a few lines below, but either way:

Nah. I have to redo it. Mathieu just pointed out in IRC that there is the
reboot and emergency/panic/kexec crap which calls set_cpu_online()
completely non serialized. Sigh....

Thanks,

tglx