[PATCH 06/10] x86: Change NR_CPUS arrays in topology

Previous thread: [PATCH 05/10] x86: Change NR_CPUS arrays in smpboot_64 by travis on Sunday, January 13, 2008 - 11:34 am. (1 message)

Next thread: [PATCH 00/10] x86: Reduce memory and intra-node effects with large count NR_CPUs by travis on Sunday, January 13, 2008 - 11:34 am. (9 messages)
From: travis
Date: Sunday, January 13, 2008 - 11:34 am

Change the following static arrays sized by NR_CPUS to
per_cpu data variables:

	i386_cpu cpu_devices[NR_CPUS];

(And change the struct name to x86_cpu.)

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Christoph Lameter <clameter@sgi.com>
---
 arch/x86/kernel/topology.c |    8 ++++----
 include/asm-x86/cpu.h      |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -31,7 +31,7 @@
 #include <linux/mmzone.h>
 #include <asm/cpu.h>
 
-static struct i386_cpu cpu_devices[NR_CPUS];
+static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
 
 int __cpuinit arch_register_cpu(int num)
 {
@@ -46,16 +46,16 @@ int __cpuinit arch_register_cpu(int num)
 	 */
 #ifdef CONFIG_HOTPLUG_CPU
 	if (num)
-		cpu_devices[num].cpu.hotpluggable = 1;
+		per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
 #endif
 
-	return register_cpu(&cpu_devices[num].cpu, num);
+	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
 void arch_unregister_cpu(int num)
 {
-	return unregister_cpu(&cpu_devices[num].cpu);
+	return unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
 EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
--- a/include/asm-x86/cpu.h
+++ b/include/asm-x86/cpu.h
@@ -7,7 +7,7 @@
 #include <linux/nodemask.h>
 #include <linux/percpu.h>
 
-struct i386_cpu {
+struct x86_cpu {
 	struct cpu cpu;
 };
 extern int arch_register_cpu(int num);

-- 
--

From: Jan Engelhardt
Date: Monday, January 14, 2008 - 11:25 am

Is not struct x86_cpu kinda redundant here if it only wraps around
one member?
--

From: Mike Travis
Date: Monday, January 14, 2008 - 12:08 pm

Looking at it, I think the x86 arch specific include file
is including the generic struct cpu (instead of say, a
different one)...?

Thanks,
Mike
--

Previous thread: [PATCH 05/10] x86: Change NR_CPUS arrays in smpboot_64 by travis on Sunday, January 13, 2008 - 11:34 am. (1 message)

Next thread: [PATCH 00/10] x86: Reduce memory and intra-node effects with large count NR_CPUs by travis on Sunday, January 13, 2008 - 11:34 am. (9 messages)