public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel/cpu.c: fix init_cpu_online
@ 2022-01-31  1:46 Yury Norov
  2022-01-31 11:19 ` Vincent Donnefort
  0 siblings, 1 reply; 3+ messages in thread
From: Yury Norov @ 2022-01-31  1:46 UTC (permalink / raw)
  To: Thomas Gleixner, Peter Zijlstra, Valentin Schneider,
	Vincent Donnefort, Ingo Molnar, YueHaibing, Yuan ZhaoXiong,
	Randy Dunlap, Mathieu Desnoyers, linux-ia64, linux-kernel
  Cc: Yury Norov

cpu_online_mask has an associate counter of online cpus, which must 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-01 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-31  1:46 [PATCH] kernel/cpu.c: fix init_cpu_online Yury Norov
2022-01-31 11:19 ` Vincent Donnefort
2022-02-01 18:30   ` Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox