Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

smp: add set_nr_cpu_ids()

In preparation to support compile-time nr_cpu_ids, add a setter for
the variable.

This is a no-op for all arches.

Signed-off-by: Yury Norov <yury.norov@gmail.com>

+12 -7
+1 -1
arch/loongarch/kernel/setup.c
··· 346 346 for (; i < NR_CPUS; i++) 347 347 set_cpu_possible(i, false); 348 348 349 - nr_cpu_ids = possible; 349 + set_nr_cpu_ids(possible); 350 350 } 351 351 #endif 352 352
+1 -1
arch/mips/kernel/setup.c
··· 750 750 for (; i < NR_CPUS; i++) 751 751 set_cpu_possible(i, false); 752 752 753 - nr_cpu_ids = possible; 753 + set_nr_cpu_ids(possible); 754 754 } 755 755 #else 756 756 static inline void prefill_possible_map(void) {}
+2 -2
arch/x86/kernel/smpboot.c
··· 1316 1316 nr++; 1317 1317 } 1318 1318 1319 - nr_cpu_ids = 8; 1319 + set_nr_cpu_ids(8); 1320 1320 } 1321 1321 #endif 1322 1322 ··· 1569 1569 possible = i; 1570 1570 } 1571 1571 1572 - nr_cpu_ids = possible; 1572 + set_nr_cpu_ids(possible); 1573 1573 1574 1574 pr_info("Allowing %d CPUs, %d hotplug CPUs\n", 1575 1575 possible, max_t(int, possible - num_processors, 0));
+1 -1
arch/x86/xen/smp_pv.c
··· 179 179 * hypercall to expand the max number of VCPUs an already 180 180 * running guest has. So cap it up to X. */ 181 181 if (subtract) 182 - nr_cpu_ids = nr_cpu_ids - subtract; 182 + set_nr_cpu_ids(nr_cpu_ids - subtract); 183 183 #endif 184 184 185 185 }
+5
include/linux/cpumask.h
··· 39 39 #define nr_cpu_ids 1U 40 40 #else 41 41 extern unsigned int nr_cpu_ids; 42 + 43 + static inline void set_nr_cpu_ids(unsigned int nr) 44 + { 45 + nr_cpu_ids = nr; 46 + } 42 47 #endif 43 48 44 49 #ifdef CONFIG_CPUMASK_OFFSTACK
+2 -2
kernel/smp.c
··· 1070 1070 int nr_cpus; 1071 1071 1072 1072 if (get_option(&str, &nr_cpus) && nr_cpus > 0 && nr_cpus < nr_cpu_ids) 1073 - nr_cpu_ids = nr_cpus; 1073 + set_nr_cpu_ids(nr_cpus); 1074 1074 1075 1075 return 0; 1076 1076 } ··· 1097 1097 /* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */ 1098 1098 void __init setup_nr_cpu_ids(void) 1099 1099 { 1100 - nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1; 1100 + set_nr_cpu_ids(find_last_bit(cpumask_bits(cpu_possible_mask), NR_CPUS) + 1); 1101 1101 } 1102 1102 1103 1103 /* Called by boot processor to activate the rest. */