diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-07-09 16:23:40 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-07-25 15:48:01 +0200 |
commit | 0c09ab96fc820109d63097a2adcbbd20836b655f (patch) | |
tree | 813c75e34ed913bf7dbe7b8e7dfbda997ac27071 /samples/seccomp | |
parent | b9fa6442f7043e2cdd247905d4f3b80f2e9605cb (diff) | |
download | linux-0c09ab96fc820109d63097a2adcbbd20836b655f.tar.bz2 |
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 'samples/seccomp')
0 files changed, 0 insertions, 0 deletions