diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-07-09 17:23:40 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-07-25 16:48:01 +0300 |
commit | 0c09ab96fc820109d63097a2adcbbd20836b655f (patch) | |
tree | 813c75e34ed913bf7dbe7b8e7dfbda997ac27071 /include/linux/lantiq.h | |
parent | b9fa6442f7043e2cdd247905d4f3b80f2e9605cb (diff) | |
download | linux-0c09ab96fc820109d63097a2adcbbd20836b655f.tar.xz |
cpu/hotplug: Cache number of online CPUs
Re-evaluating the bitmap wheight of the online cpus bitmap in every
invocation of num_online_cpus() over and over is a pretty useless
exercise. Especially when num_online_cpus() is used in code paths
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. The accessor function provides only a snapshot when used without
protection against concurrent CPU hotplug.
The storage needs to use an atomic_t because the kexec and reboot code
(ab)use set_cpu_online() in their 'shutdown' handlers without any form of
serialization as pointed out by Mathieu. Regular CPU hotplug usage is
properly serialized.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1907091622590.1634@nanos.tec.linutronix.de
Diffstat (limited to 'include/linux/lantiq.h')
0 files changed, 0 insertions, 0 deletions