lkml.org 
[lkml]   [2000]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Make sure cpu_data[] is cache line aligned


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/
\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.021 / U:1.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site