Commit 168ef543 authored by Mike Travis's avatar Mike Travis

x86: prepare for cpumask iterators to only go to nr_cpu_ids

Impact: cleanup, futureproof

In fact, all cpumask ops will only be valid (in general) for bit
numbers < nr_cpu_ids.  So use that instead of NR_CPUS in various
places.

This is always safe: no cpu number can be >= nr_cpu_ids, and
nr_cpu_ids is initialized to NR_CPUS at boot.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarMike Travis <travis@sgi.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
parent 78637a97
...@@ -2106,7 +2106,7 @@ __cpuinit int apic_is_clustered_box(void) ...@@ -2106,7 +2106,7 @@ __cpuinit int apic_is_clustered_box(void)
bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid); bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
bitmap_zero(clustermap, NUM_APIC_CLUSTERS); bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < nr_cpu_ids; i++) {
/* are we being called early in kernel startup? */ /* are we being called early in kernel startup? */
if (bios_cpu_apicid) { if (bios_cpu_apicid) {
id = bios_cpu_apicid[i]; id = bios_cpu_apicid[i];
......
...@@ -672,7 +672,7 @@ void __init smp_boot_cpus(void) ...@@ -672,7 +672,7 @@ void __init smp_boot_cpus(void)
/* loop over all the extended VIC CPUs and boot them. The /* loop over all the extended VIC CPUs and boot them. The
* Quad CPUs must be bootstrapped by their extended VIC cpu */ * Quad CPUs must be bootstrapped by their extended VIC cpu */
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < nr_cpu_ids; i++) {
if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map)) if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map))
continue; continue;
do_boot_cpu(i); do_boot_cpu(i);
......
...@@ -278,7 +278,7 @@ void __init numa_init_array(void) ...@@ -278,7 +278,7 @@ void __init numa_init_array(void)
int rr, i; int rr, i;
rr = first_node(node_online_map); rr = first_node(node_online_map);
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < nr_cpu_ids; i++) {
if (early_cpu_to_node(i) != NUMA_NO_NODE) if (early_cpu_to_node(i) != NUMA_NO_NODE)
continue; continue;
numa_set_node(i, rr); numa_set_node(i, rr);
...@@ -549,7 +549,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn) ...@@ -549,7 +549,7 @@ void __init initmem_init(unsigned long start_pfn, unsigned long last_pfn)
memnodemap[0] = 0; memnodemap[0] = 0;
node_set_online(0); node_set_online(0);
node_set(0, node_possible_map); node_set(0, node_possible_map);
for (i = 0; i < NR_CPUS; i++) for (i = 0; i < nr_cpu_ids; i++)
numa_set_node(i, 0); numa_set_node(i, 0);
e820_register_active_regions(0, start_pfn, last_pfn); e820_register_active_regions(0, start_pfn, last_pfn);
setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT); setup_node_bootmem(0, start_pfn << PAGE_SHIFT, last_pfn << PAGE_SHIFT);
......
...@@ -382,7 +382,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) ...@@ -382,7 +382,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
if (!node_online(i)) if (!node_online(i))
setup_node_bootmem(i, nodes[i].start, nodes[i].end); setup_node_bootmem(i, nodes[i].start, nodes[i].end);
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < nr_cpu_ids; i++) {
int node = early_cpu_to_node(i); int node = early_cpu_to_node(i);
if (node == NUMA_NO_NODE) if (node == NUMA_NO_NODE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment