x86: convert cpu_to_apicid to be a per cpu variable
This patch converts the x86_cpu_to_apicid array to be a per cpu variable. This saves sizeof(apicid) * NR unused cpus. Access is mostly from startup and CPU HOTPLUG functions. MP_processor_info() is one of the functions that require access to the x86_cpu_to_apicid array before the per_cpu data area is setup. For this case, a pointer to the __initdata array is initialized in setup_arch() and removed in smp_prepare_cpus() after the per_cpu data area is initialized. A second change is included to change the initial array value of ARCH i386 from 0xff to BAD_APICID to be consistent with ARCH x86_64. Signed-off-by: Mike Travis <travis@sgi.com> Cc: Andi Kleen <ak@suse.de> Cc: Christoph Lameter <clameter@sgi.com> Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:

committed by
Thomas Gleixner

parent
dbeb2be21d
commit
71fff5e6ca
@@ -694,7 +694,7 @@ do_rest:
|
||||
clear_node_cpumask(cpu); /* was set by numa_add_cpu */
|
||||
cpu_clear(cpu, cpu_present_map);
|
||||
cpu_clear(cpu, cpu_possible_map);
|
||||
x86_cpu_to_apicid[cpu] = BAD_APICID;
|
||||
per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -840,6 +840,26 @@ static int __init smp_sanity_check(unsigned max_cpus)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy apicid's found by MP_processor_info from initial array to the per cpu
|
||||
* data area. The x86_cpu_to_apicid_init array is then expendable and the
|
||||
* x86_cpu_to_apicid_ptr is zeroed indicating that the static array is no
|
||||
* longer available.
|
||||
*/
|
||||
void __init smp_set_apicids(void)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_cpu_mask(cpu, cpu_possible_map) {
|
||||
if (per_cpu_offset(cpu))
|
||||
per_cpu(x86_cpu_to_apicid, cpu) =
|
||||
x86_cpu_to_apicid_init[cpu];
|
||||
}
|
||||
|
||||
/* indicate the static array will be going away soon */
|
||||
x86_cpu_to_apicid_ptr = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare for SMP bootup. The MP table or ACPI has been read
|
||||
* earlier. Just do some sanity checking here and enable APIC mode.
|
||||
@@ -849,6 +869,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
|
||||
nmi_watchdog_default();
|
||||
current_cpu_data = boot_cpu_data;
|
||||
current_thread_info()->cpu = 0; /* needed? */
|
||||
smp_set_apicids();
|
||||
set_cpu_sibling_map(0);
|
||||
|
||||
if (smp_sanity_check(max_cpus) < 0) {
|
||||
|
Reference in New Issue
Block a user