Commit e323969c authored by Catalin Marinas's avatar Catalin Marinas

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: default avatarWill Deacon <will.deacon@arm.com>
Tested-by: default avatarWill Deacon <will.deacon@arm.com>
Reviewed-by: default avatarFrank Rowand <frank.rowand@am.sony.com>
Tested-by: default avatarMarc Zyngier <Marc.Zyngier@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 7fec1b57
...@@ -43,9 +43,6 @@ void __check_kvm_seq(struct mm_struct *mm); ...@@ -43,9 +43,6 @@ void __check_kvm_seq(struct mm_struct *mm);
#define ASID_FIRST_VERSION (1 << ASID_BITS) #define ASID_FIRST_VERSION (1 << ASID_BITS)
extern unsigned int cpu_last_asid; extern unsigned int cpu_last_asid;
#ifdef CONFIG_SMP
DECLARE_PER_CPU(struct mm_struct *, current_mm);
#endif
void __init_new_context(struct task_struct *tsk, struct mm_struct *mm); void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
void __new_context(struct mm_struct *mm); void __new_context(struct mm_struct *mm);
...@@ -160,10 +157,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, ...@@ -160,10 +157,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
__flush_icache_all(); __flush_icache_all();
#endif #endif
if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) { if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
#ifdef CONFIG_SMP
struct mm_struct **crt_mm = &per_cpu(current_mm, cpu);
*crt_mm = next;
#endif
check_and_switch_context(next, tsk); check_and_switch_context(next, tsk);
if (cache_is_vivt()) if (cache_is_vivt())
cpumask_clear_cpu(cpu, mm_cpumask(prev)); cpumask_clear_cpu(cpu, mm_cpumask(prev));
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
static DEFINE_RAW_SPINLOCK(cpu_asid_lock); static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
unsigned int cpu_last_asid = ASID_FIRST_VERSION; unsigned int cpu_last_asid = ASID_FIRST_VERSION;
#ifdef CONFIG_SMP
DEFINE_PER_CPU(struct mm_struct *, current_mm);
#endif
#ifdef CONFIG_ARM_LPAE #ifdef CONFIG_ARM_LPAE
void cpu_set_reserved_ttbr0(void) void cpu_set_reserved_ttbr0(void)
...@@ -108,14 +105,7 @@ static void reset_context(void *info) ...@@ -108,14 +105,7 @@ static void reset_context(void *info)
{ {
unsigned int asid; unsigned int asid;
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
struct mm_struct *mm = per_cpu(current_mm, cpu); struct mm_struct *mm = current->active_mm;
/*
* Check if a current_mm was set on this CPU as it might still
* be in the early booting stages and using the reserved ASID.
*/
if (!mm)
return;
smp_rmb(); smp_rmb();
asid = cpu_last_asid + cpu + 1; asid = cpu_last_asid + cpu + 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment