diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2011-11-28 10:59:10 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-04-17 10:29:37 -0400 |
commit | e323969ccda2d69f02e047c08b03faa09215c72a (patch) | |
tree | 27ed693ec5bb114773f267722bdd0db371a4f5a2 | |
parent | 7fec1b57b8a925d83c194f995f83d9f8442fd48e (diff) |
ARM: Remove current_mm per-cpu variable
The current_mm variable was used to store the new mm between the
switch_mm() and switch_to() calls where an IPI to reset the context
could have set the wrong mm. Since the interrupts are disabled during
context switch, there is no need for this variable, current->active_mm
already points to the current mm when interrupts are re-enabled.
Reviewed-by: Will Deacon <will.deacon@arm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Marc Zyngier <Marc.Zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm/include/asm/mmu_context.h | 7 | ||||
-rw-r--r-- | arch/arm/mm/context.c | 12 |
2 files changed, 1 insertions, 18 deletions
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 94e265cb5146..8da4b9c042fe 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -43,9 +43,6 @@ void __check_kvm_seq(struct mm_struct *mm); | |||
43 | #define ASID_FIRST_VERSION (1 << ASID_BITS) | 43 | #define ASID_FIRST_VERSION (1 << ASID_BITS) |
44 | 44 | ||
45 | extern unsigned int cpu_last_asid; | 45 | extern unsigned int cpu_last_asid; |
46 | #ifdef CONFIG_SMP | ||
47 | DECLARE_PER_CPU(struct mm_struct *, current_mm); | ||
48 | #endif | ||
49 | 46 | ||
50 | void __init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 47 | void __init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
51 | void __new_context(struct mm_struct *mm); | 48 | void __new_context(struct mm_struct *mm); |
@@ -160,10 +157,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
160 | __flush_icache_all(); | 157 | __flush_icache_all(); |
161 | #endif | 158 | #endif |
162 | if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) { | 159 | if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) { |
163 | #ifdef CONFIG_SMP | ||
164 | struct mm_struct **crt_mm = &per_cpu(current_mm, cpu); | ||
165 | *crt_mm = next; | ||
166 | #endif | ||
167 | check_and_switch_context(next, tsk); | 160 | check_and_switch_context(next, tsk); |
168 | if (cache_is_vivt()) | 161 | if (cache_is_vivt()) |
169 | cpumask_clear_cpu(cpu, mm_cpumask(prev)); | 162 | cpumask_clear_cpu(cpu, mm_cpumask(prev)); |
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index 06a2e7ce23c3..806cc4f63516 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c | |||
@@ -18,9 +18,6 @@ | |||
18 | 18 | ||
19 | static DEFINE_RAW_SPINLOCK(cpu_asid_lock); | 19 | static DEFINE_RAW_SPINLOCK(cpu_asid_lock); |
20 | unsigned int cpu_last_asid = ASID_FIRST_VERSION; | 20 | unsigned int cpu_last_asid = ASID_FIRST_VERSION; |
21 | #ifdef CONFIG_SMP | ||
22 | DEFINE_PER_CPU(struct mm_struct *, current_mm); | ||
23 | #endif | ||
24 | 21 | ||
25 | #ifdef CONFIG_ARM_LPAE | 22 | #ifdef CONFIG_ARM_LPAE |
26 | void cpu_set_reserved_ttbr0(void) | 23 | void cpu_set_reserved_ttbr0(void) |
@@ -108,14 +105,7 @@ static void reset_context(void *info) | |||
108 | { | 105 | { |
109 | unsigned int asid; | 106 | unsigned int asid; |
110 | unsigned int cpu = smp_processor_id(); | 107 | unsigned int cpu = smp_processor_id(); |
111 | struct mm_struct *mm = per_cpu(current_mm, cpu); | 108 | struct mm_struct *mm = current->active_mm; |
112 | |||
113 | /* | ||
114 | * Check if a current_mm was set on this CPU as it might still | ||
115 | * be in the early booting stages and using the reserved ASID. | ||
116 | */ | ||
117 | if (!mm) | ||
118 | return; | ||
119 | 109 | ||
120 | smp_rmb(); | 110 | smp_rmb(); |
121 | asid = cpu_last_asid + cpu + 1; | 111 | asid = cpu_last_asid + cpu + 1; |