diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-01-18 10:38:57 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-01-18 10:38:57 -0500 |
commit | 9eb912d1aa6b8106e06a73ea6702ec3dab0d6a1a (patch) | |
tree | ed563ea82e5190894806c62d87a769400b08375a /arch/x86/kernel | |
parent | 1b437c8c73a36daa471dd54a63c426d72af5723d (diff) |
x86-64: Move TLB state from PDA to per-cpu and consolidate with 32-bit.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/tlb_32.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/tlb_64.c | 13 |
3 files changed, 10 insertions, 17 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index c49498d40830..3d0cc6f17116 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -897,8 +897,6 @@ void __cpuinit pda_init(int cpu) | |||
897 | pda->irqcount = -1; | 897 | pda->irqcount = -1; |
898 | pda->kernelstack = (unsigned long)stack_thread_info() - | 898 | pda->kernelstack = (unsigned long)stack_thread_info() - |
899 | PDA_STACKOFFSET + THREAD_SIZE; | 899 | PDA_STACKOFFSET + THREAD_SIZE; |
900 | pda->active_mm = &init_mm; | ||
901 | pda->mmu_state = 0; | ||
902 | 900 | ||
903 | if (cpu == 0) { | 901 | if (cpu == 0) { |
904 | /* others are initialized in smpboot.c */ | 902 | /* others are initialized in smpboot.c */ |
diff --git a/arch/x86/kernel/tlb_32.c b/arch/x86/kernel/tlb_32.c index e65449d0f7d9..abf0808d6fc4 100644 --- a/arch/x86/kernel/tlb_32.c +++ b/arch/x86/kernel/tlb_32.c | |||
@@ -4,8 +4,8 @@ | |||
4 | 4 | ||
5 | #include <asm/tlbflush.h> | 5 | #include <asm/tlbflush.h> |
6 | 6 | ||
7 | DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) | 7 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) |
8 | ____cacheline_aligned = { &init_mm, 0, }; | 8 | = { &init_mm, 0, }; |
9 | 9 | ||
10 | /* must come after the send_IPI functions above for inlining */ | 10 | /* must come after the send_IPI functions above for inlining */ |
11 | #include <mach_ipi.h> | 11 | #include <mach_ipi.h> |
@@ -231,14 +231,6 @@ void flush_tlb_all(void) | |||
231 | on_each_cpu(do_flush_tlb_all, NULL, 1); | 231 | on_each_cpu(do_flush_tlb_all, NULL, 1); |
232 | } | 232 | } |
233 | 233 | ||
234 | void reset_lazy_tlbstate(void) | ||
235 | { | ||
236 | int cpu = raw_smp_processor_id(); | ||
237 | |||
238 | per_cpu(cpu_tlbstate, cpu).state = 0; | ||
239 | per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm; | ||
240 | } | ||
241 | |||
242 | static int init_flush_cpumask(void) | 234 | static int init_flush_cpumask(void) |
243 | { | 235 | { |
244 | alloc_cpumask_var(&flush_cpumask, GFP_KERNEL); | 236 | alloc_cpumask_var(&flush_cpumask, GFP_KERNEL); |
diff --git a/arch/x86/kernel/tlb_64.c b/arch/x86/kernel/tlb_64.c index 7f4141d3b661..e64a32c48825 100644 --- a/arch/x86/kernel/tlb_64.c +++ b/arch/x86/kernel/tlb_64.c | |||
@@ -18,6 +18,9 @@ | |||
18 | #include <asm/uv/uv_hub.h> | 18 | #include <asm/uv/uv_hub.h> |
19 | #include <asm/uv/uv_bau.h> | 19 | #include <asm/uv/uv_bau.h> |
20 | 20 | ||
21 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) | ||
22 | = { &init_mm, 0, }; | ||
23 | |||
21 | #include <mach_ipi.h> | 24 | #include <mach_ipi.h> |
22 | /* | 25 | /* |
23 | * Smarter SMP flushing macros. | 26 | * Smarter SMP flushing macros. |
@@ -62,9 +65,9 @@ static DEFINE_PER_CPU(union smp_flush_state, flush_state); | |||
62 | */ | 65 | */ |
63 | void leave_mm(int cpu) | 66 | void leave_mm(int cpu) |
64 | { | 67 | { |
65 | if (read_pda(mmu_state) == TLBSTATE_OK) | 68 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) |
66 | BUG(); | 69 | BUG(); |
67 | cpu_clear(cpu, read_pda(active_mm)->cpu_vm_mask); | 70 | cpu_clear(cpu, percpu_read(cpu_tlbstate.active_mm)->cpu_vm_mask); |
68 | load_cr3(swapper_pg_dir); | 71 | load_cr3(swapper_pg_dir); |
69 | } | 72 | } |
70 | EXPORT_SYMBOL_GPL(leave_mm); | 73 | EXPORT_SYMBOL_GPL(leave_mm); |
@@ -142,8 +145,8 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) | |||
142 | * BUG(); | 145 | * BUG(); |
143 | */ | 146 | */ |
144 | 147 | ||
145 | if (f->flush_mm == read_pda(active_mm)) { | 148 | if (f->flush_mm == percpu_read(cpu_tlbstate.active_mm)) { |
146 | if (read_pda(mmu_state) == TLBSTATE_OK) { | 149 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { |
147 | if (f->flush_va == TLB_FLUSH_ALL) | 150 | if (f->flush_va == TLB_FLUSH_ALL) |
148 | local_flush_tlb(); | 151 | local_flush_tlb(); |
149 | else | 152 | else |
@@ -281,7 +284,7 @@ static void do_flush_tlb_all(void *info) | |||
281 | unsigned long cpu = smp_processor_id(); | 284 | unsigned long cpu = smp_processor_id(); |
282 | 285 | ||
283 | __flush_tlb_all(); | 286 | __flush_tlb_all(); |
284 | if (read_pda(mmu_state) == TLBSTATE_LAZY) | 287 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) |
285 | leave_mm(cpu); | 288 | leave_mm(cpu); |
286 | } | 289 | } |
287 | 290 | ||