Thread (24 messages) 24 messages, 4 authors, 2021-12-21
STALE1666d
Revisions (3)
  1. v2 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]

[PATCH 12/17] kernel/cpu.c: fix init_cpu_online

From: Yury Norov <yury.norov@gmail.com>
Date: 2021-12-18 21:22:07
Also in: kvm, linux-crypto, linux-mips, linux-mm, linux-perf-users, linux-riscv, linux-s390, lkml
Subsystem: cpu hotplug, the rest · Maintainers: Thomas Gleixner, Peter Zijlstra, Linus Torvalds

cpu_online_mask has an associate counter of online cpus, which should be
initialized in init_cpu_online()

Fixes: 0c09ab96fc82010 (cpu/hotplug: Cache number of online CPUs)
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 kernel/cpu.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 407a2568f35e..cd7605204d4d 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2616,6 +2616,7 @@ void init_cpu_possible(const struct cpumask *src)
 void init_cpu_online(const struct cpumask *src)
 {
 	cpumask_copy(&__cpu_online_mask, src);
+	atomic_set(&__num_online_cpus, cpumask_weight(cpu_online_mask));
 }
 
 void set_cpu_online(unsigned int cpu, bool online)
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help