aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-01-13 06:41:35 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-16 08:19:40 -0500
commitc8f3329a0ddd751241e96b4100df7eda14b2cbc6 (patch)
tree55e201da3d0d26076d4e31ef68aad26bf9f3e08c
parentf32ff5388d86518c0375ccdb330d3b459b9c405e (diff)
x86: use static _cpu_pda array
_cpu_pda array first uses statically allocated storage in data.init and then switches to allocated bootmem to conserve space. However, after folding pda area into percpu area, _cpu_pda array will be removed completely. Drop the reallocation part to simplify the code for soon-to-follow changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/include/asm/pda.h3
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/head64.c12
-rw-r--r--arch/x86/kernel/setup_percpu.c14
4 files changed, 6 insertions, 25 deletions
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h
index cbd3f48a8320..2d5b49c3248e 100644
--- a/arch/x86/include/asm/pda.h
+++ b/arch/x86/include/asm/pda.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/cache.h> 7#include <linux/cache.h>
8#include <linux/threads.h>
8#include <asm/page.h> 9#include <asm/page.h>
9 10
10/* Per processor datastructure. %gs points to it while the kernel runs */ 11/* Per processor datastructure. %gs points to it while the kernel runs */
@@ -39,7 +40,7 @@ struct x8664_pda {
39 unsigned irq_spurious_count; 40 unsigned irq_spurious_count;
40} ____cacheline_aligned_in_smp; 41} ____cacheline_aligned_in_smp;
41 42
42extern struct x8664_pda **_cpu_pda; 43extern struct x8664_pda *_cpu_pda[NR_CPUS];
43extern void pda_init(int); 44extern void pda_init(int);
44 45
45#define cpu_pda(i) (_cpu_pda[i]) 46#define cpu_pda(i) (_cpu_pda[i])
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f00258462444..c116c599326e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -879,7 +879,7 @@ static __init int setup_disablecpuid(char *arg)
879__setup("clearcpuid=", setup_disablecpuid); 879__setup("clearcpuid=", setup_disablecpuid);
880 880
881#ifdef CONFIG_X86_64 881#ifdef CONFIG_X86_64
882struct x8664_pda **_cpu_pda __read_mostly; 882struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
883EXPORT_SYMBOL(_cpu_pda); 883EXPORT_SYMBOL(_cpu_pda);
884 884
885struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; 885struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 76ffba2aa66d..462d0beccb6b 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -29,20 +29,8 @@
29/* boot cpu pda, referenced by head_64.S to initialize %gs for boot CPU */ 29/* boot cpu pda, referenced by head_64.S to initialize %gs for boot CPU */
30struct x8664_pda _boot_cpu_pda; 30struct x8664_pda _boot_cpu_pda;
31 31
32#ifdef CONFIG_SMP
33/*
34 * We install an empty cpu_pda pointer table to indicate to early users
35 * (numa_set_node) that the cpu_pda pointer table for cpus other than
36 * the boot cpu is not yet setup.
37 */
38static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata;
39#else
40static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly;
41#endif
42
43void __init x86_64_init_pda(void) 32void __init x86_64_init_pda(void)
44{ 33{
45 _cpu_pda = __cpu_pda;
46 cpu_pda(0) = &_boot_cpu_pda; 34 cpu_pda(0) = &_boot_cpu_pda;
47 cpu_pda(0)->data_offset = 35 cpu_pda(0)->data_offset =
48 (unsigned long)(__per_cpu_load - __per_cpu_start); 36 (unsigned long)(__per_cpu_load - __per_cpu_start);
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 44845842e722..73ab01b297c5 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -114,7 +114,6 @@ static inline void setup_cpu_pda_map(void) { }
114static void __init setup_cpu_pda_map(void) 114static void __init setup_cpu_pda_map(void)
115{ 115{
116 char *pda; 116 char *pda;
117 struct x8664_pda **new_cpu_pda;
118 unsigned long size; 117 unsigned long size;
119 int cpu; 118 int cpu;
120 119
@@ -122,28 +121,21 @@ static void __init setup_cpu_pda_map(void)
122 121
123 /* allocate cpu_pda array and pointer table */ 122 /* allocate cpu_pda array and pointer table */
124 { 123 {
125 unsigned long tsize = nr_cpu_ids * sizeof(void *);
126 unsigned long asize = size * (nr_cpu_ids - 1); 124 unsigned long asize = size * (nr_cpu_ids - 1);
127 125
128 tsize = roundup(tsize, cache_line_size()); 126 pda = alloc_bootmem(asize);
129 new_cpu_pda = alloc_bootmem(tsize + asize);
130 pda = (char *)new_cpu_pda + tsize;
131 } 127 }
132 128
133 /* initialize pointer table to static pda's */ 129 /* initialize pointer table to static pda's */
134 for_each_possible_cpu(cpu) { 130 for_each_possible_cpu(cpu) {
135 if (cpu == 0) { 131 if (cpu == 0) {
136 /* leave boot cpu pda in place */ 132 /* leave boot cpu pda in place */
137 new_cpu_pda[0] = cpu_pda(0);
138 continue; 133 continue;
139 } 134 }
140 new_cpu_pda[cpu] = (struct x8664_pda *)pda; 135 cpu_pda(cpu) = (struct x8664_pda *)pda;
141 new_cpu_pda[cpu]->in_bootmem = 1; 136 cpu_pda(cpu)->in_bootmem = 1;
142 pda += size; 137 pda += size;
143 } 138 }
144
145 /* point to new pointer table */
146 _cpu_pda = new_cpu_pda;
147} 139}
148 140
149#endif /* CONFIG_SMP && CONFIG_X86_64 */ 141#endif /* CONFIG_SMP && CONFIG_X86_64 */