Skip to content

Commit 4596749

Browse files
snevesIngo Molnar
authored andcommitted
x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations
Without this fix, /proc/cpuinfo will display an incorrect amount of CPU cores, after bringing them offline and online again, as exemplified below: $ cat /proc/cpuinfo | grep cores cpu cores : 4 cpu cores : 8 cpu cores : 8 cpu cores : 20 cpu cores : 4 cpu cores : 3 cpu cores : 2 cpu cores : 2 This patch fixes this by always zeroing the booted_cores variable upon turning off a logical CPU. Tested-by: Dou Liyang <[email protected]> Signed-off-by: Samuel Neves <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 0c52f7c commit 4596749

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,7 @@ static void remove_siblinginfo(int cpu)
14371437
cpumask_clear(topology_sibling_cpumask(cpu));
14381438
cpumask_clear(topology_core_cpumask(cpu));
14391439
c->cpu_core_id = 0;
1440+
c->booted_cores = 0;
14401441
cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
14411442
recompute_smt_state();
14421443
}

0 commit comments

Comments
 (0)