diff options
author | Christoph Lameter <christoph@lameter.com> | 2005-07-07 20:56:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-07 21:23:46 -0400 |
commit | 6c036527a630720063b67d9a65455e8caca2c8fa (patch) | |
tree | 316e947f5f4efcda0205e48044ed1d12665eaed1 /arch/i386/kernel | |
parent | 0db925af1db5f3dfe1691c35b39496e2baaff9c9 (diff) |
[PATCH] mostly_read data section
Add a new section called ".data.read_mostly" for data items that are read
frequently and rarely written to like cpumaps etc.
If these maps are placed in the .data section then these frequenly read
items may end up in cachelines with data is is frequently updated. In that
case all processors in an SMP system must needlessly reload the cachelines
again and again containing elements of those frequently used variables.
The ability to share these cachelines will allow each cpu in an SMP system
to keep local copies of those shared cachelines thereby optimizing
performance.
Signed-off-by: Alok N Kataria <alokk@calsoftinc.com>
Signed-off-by: Shobhit Dayal <shobhit@calsoftinc.com>
Signed-off-by: Christoph Lameter <christoph@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/cpu/intel.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 18 | ||||
-rw-r--r-- | arch/i386/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/timers/timer_hpet.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/vmlinux.lds.S | 3 |
5 files changed, 16 insertions, 13 deletions
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c index 96a75d045835..a2c33c1a46c5 100644 --- a/arch/i386/kernel/cpu/intel.c +++ b/arch/i386/kernel/cpu/intel.c | |||
@@ -25,7 +25,7 @@ extern int trap_init_f00f_bug(void); | |||
25 | /* | 25 | /* |
26 | * Alignment at which movsl is preferred for bulk memory copies. | 26 | * Alignment at which movsl is preferred for bulk memory copies. |
27 | */ | 27 | */ |
28 | struct movsl_mask movsl_mask; | 28 | struct movsl_mask movsl_mask __read_mostly; |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | void __devinit early_intel_workaround(struct cpuinfo_x86 *c) | 31 | void __devinit early_intel_workaround(struct cpuinfo_x86 *c) |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index d66bf489a2e9..8ac8e9fd5614 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -68,21 +68,21 @@ EXPORT_SYMBOL(smp_num_siblings); | |||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* Package ID of each logical CPU */ | 70 | /* Package ID of each logical CPU */ |
71 | int phys_proc_id[NR_CPUS] = {[0 ... NR_CPUS-1] = BAD_APICID}; | 71 | int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; |
72 | EXPORT_SYMBOL(phys_proc_id); | 72 | EXPORT_SYMBOL(phys_proc_id); |
73 | 73 | ||
74 | /* Core ID of each logical CPU */ | 74 | /* Core ID of each logical CPU */ |
75 | int cpu_core_id[NR_CPUS] = {[0 ... NR_CPUS-1] = BAD_APICID}; | 75 | int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; |
76 | EXPORT_SYMBOL(cpu_core_id); | 76 | EXPORT_SYMBOL(cpu_core_id); |
77 | 77 | ||
78 | cpumask_t cpu_sibling_map[NR_CPUS]; | 78 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; |
79 | EXPORT_SYMBOL(cpu_sibling_map); | 79 | EXPORT_SYMBOL(cpu_sibling_map); |
80 | 80 | ||
81 | cpumask_t cpu_core_map[NR_CPUS]; | 81 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly; |
82 | EXPORT_SYMBOL(cpu_core_map); | 82 | EXPORT_SYMBOL(cpu_core_map); |
83 | 83 | ||
84 | /* bitmap of online cpus */ | 84 | /* bitmap of online cpus */ |
85 | cpumask_t cpu_online_map; | 85 | cpumask_t cpu_online_map __read_mostly; |
86 | EXPORT_SYMBOL(cpu_online_map); | 86 | EXPORT_SYMBOL(cpu_online_map); |
87 | 87 | ||
88 | cpumask_t cpu_callin_map; | 88 | cpumask_t cpu_callin_map; |
@@ -100,7 +100,7 @@ static int __devinitdata tsc_sync_disabled; | |||
100 | struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; | 100 | struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; |
101 | EXPORT_SYMBOL(cpu_data); | 101 | EXPORT_SYMBOL(cpu_data); |
102 | 102 | ||
103 | u8 x86_cpu_to_apicid[NR_CPUS] = | 103 | u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = |
104 | { [0 ... NR_CPUS-1] = 0xff }; | 104 | { [0 ... NR_CPUS-1] = 0xff }; |
105 | EXPORT_SYMBOL(x86_cpu_to_apicid); | 105 | EXPORT_SYMBOL(x86_cpu_to_apicid); |
106 | 106 | ||
@@ -550,10 +550,10 @@ extern struct { | |||
550 | #ifdef CONFIG_NUMA | 550 | #ifdef CONFIG_NUMA |
551 | 551 | ||
552 | /* which logical CPUs are on which nodes */ | 552 | /* which logical CPUs are on which nodes */ |
553 | cpumask_t node_2_cpu_mask[MAX_NUMNODES] = | 553 | cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly = |
554 | { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; | 554 | { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; |
555 | /* which node each logical CPU is on */ | 555 | /* which node each logical CPU is on */ |
556 | int cpu_2_node[NR_CPUS] = { [0 ... NR_CPUS-1] = 0 }; | 556 | int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; |
557 | EXPORT_SYMBOL(cpu_2_node); | 557 | EXPORT_SYMBOL(cpu_2_node); |
558 | 558 | ||
559 | /* set up a mapping between cpu and node. */ | 559 | /* set up a mapping between cpu and node. */ |
@@ -581,7 +581,7 @@ static inline void unmap_cpu_to_node(int cpu) | |||
581 | 581 | ||
582 | #endif /* CONFIG_NUMA */ | 582 | #endif /* CONFIG_NUMA */ |
583 | 583 | ||
584 | u8 cpu_2_logical_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; | 584 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; |
585 | 585 | ||
586 | static void map_cpu_to_logical_apicid(void) | 586 | static void map_cpu_to_logical_apicid(void) |
587 | { | 587 | { |
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 2854c357377f..0ee9dee8af06 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -91,7 +91,7 @@ EXPORT_SYMBOL(rtc_lock); | |||
91 | DEFINE_SPINLOCK(i8253_lock); | 91 | DEFINE_SPINLOCK(i8253_lock); |
92 | EXPORT_SYMBOL(i8253_lock); | 92 | EXPORT_SYMBOL(i8253_lock); |
93 | 93 | ||
94 | struct timer_opts *cur_timer = &timer_none; | 94 | struct timer_opts *cur_timer __read_mostly = &timer_none; |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * This is a special lock that is owned by the CPU and holds the index | 97 | * This is a special lock that is owned by the CPU and holds the index |
diff --git a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c index d766e0963ac1..ef8dac5dd33b 100644 --- a/arch/i386/kernel/timers/timer_hpet.c +++ b/arch/i386/kernel/timers/timer_hpet.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include "mach_timer.h" | 18 | #include "mach_timer.h" |
19 | #include <asm/hpet.h> | 19 | #include <asm/hpet.h> |
20 | 20 | ||
21 | static unsigned long hpet_usec_quotient; /* convert hpet clks to usec */ | 21 | static unsigned long __read_mostly hpet_usec_quotient; /* convert hpet clks to usec */ |
22 | static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */ | 22 | static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */ |
23 | static unsigned long hpet_last; /* hpet counter value at last tick*/ | 23 | static unsigned long hpet_last; /* hpet counter value at last tick*/ |
24 | static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ | 24 | static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ |
@@ -180,7 +180,7 @@ static int __init init_hpet(char* override) | |||
180 | /************************************************************/ | 180 | /************************************************************/ |
181 | 181 | ||
182 | /* tsc timer_opts struct */ | 182 | /* tsc timer_opts struct */ |
183 | static struct timer_opts timer_hpet = { | 183 | static struct timer_opts timer_hpet __read_mostly = { |
184 | .name = "hpet", | 184 | .name = "hpet", |
185 | .mark_offset = mark_offset_hpet, | 185 | .mark_offset = mark_offset_hpet, |
186 | .get_offset = get_offset_hpet, | 186 | .get_offset = get_offset_hpet, |
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S index 7e01a528a83a..761972f8cb6c 100644 --- a/arch/i386/kernel/vmlinux.lds.S +++ b/arch/i386/kernel/vmlinux.lds.S | |||
@@ -57,6 +57,9 @@ SECTIONS | |||
57 | *(.data.cacheline_aligned) | 57 | *(.data.cacheline_aligned) |
58 | } | 58 | } |
59 | 59 | ||
60 | /* rarely changed data like cpu maps */ | ||
61 | . = ALIGN(32); | ||
62 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) } | ||
60 | _edata = .; /* End of data section */ | 63 | _edata = .; /* End of data section */ |
61 | 64 | ||
62 | . = ALIGN(THREAD_SIZE); /* init_task */ | 65 | . = ALIGN(THREAD_SIZE); /* init_task */ |