[PATCH] Make sure cpu_data[] is cache line aligned

From: Andi Kleen (ak@suse.de)
Date: Sun Oct 22 2000 - 04:25:47 EST


Hi Alan,

cpu_data[] should be cache line aligned to make the per CPU pte allocation
tricks work without false sharing. This patch ensure this
(against 2.2.18pre15). Without it it is rather a gamble (1 : 8). With 32
byte cache lines it probably does not hurt too much because the stuff
at the beginning of cpuinfo_x86 is not frequently accessed, and it ensures
that the hot fields are separated by at least 32bytes, but with P4-SMP and
K7-SMP that will likely not work anymore.

Please apply,

-Andi

--- linux-work/arch/i386/kernel/smp.c-BOOTFIX Fri Oct 20 06:19:46 2000
+++ linux-work/arch/i386/kernel/smp.c Sun Oct 22 10:57:11 2000
@@ -112,7 +112,9 @@
 static volatile unsigned long cpu_callout_map[NR_CPUS] = {0,}; /* We always use 0 the rest is ready for parallel delivery */
 volatile unsigned long smp_invalidate_needed; /* Used for the invalidate map that's also checked in the spinlock */
 volatile unsigned long kstack_ptr; /* Stack vector for booting CPUs */
-struct cpuinfo_x86 cpu_data[NR_CPUS]; /* Per CPU bogomips and other parameters */
+struct cpuinfo_x86 cpu_data[NR_CPUS]
+__attribute__((__section(".data.cacheline_aligned"),__align__(SMP_CACHE_BYTES)));
+ /* Per CPU bogomips and other parameters */
 static unsigned int num_processors = 1; /* Internal processor count */
 unsigned char boot_cpu_id = 0; /* Processor that is doing the boot up */
 static int smp_activated = 0; /* Tripped once we need to start cross invalidating */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:19 EST