diff options
author | Pavel Tatashin <pasha.tatashin@oracle.com> | 2017-05-31 11:25:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-06 16:45:29 -0400 |
commit | 7a5b4bbf49fe86ce77488a70c5dccfe2d50d7a2d (patch) | |
tree | d53db5c2f4b5cd9a675a1b3f85fe370ec8a672b5 | |
parent | c4415235b2be0cc791572e8e7f7466ab8f73a2bf (diff) |
sparc64: add per-cpu mm of secondary contexts
The new wrap is going to use information from this array to figure out
mm's that currently have valid secondary contexts setup.
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reviewed-by: Bob Picco <bob.picco@oracle.com>
Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/include/asm/mmu_context_64.h | 5 | ||||
-rw-r--r-- | arch/sparc/mm/init_64.c | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h index 734a1343d77d..edb45247bfa9 100644 --- a/arch/sparc/include/asm/mmu_context_64.h +++ b/arch/sparc/include/asm/mmu_context_64.h | |||
@@ -19,6 +19,7 @@ extern spinlock_t ctx_alloc_lock; | |||
19 | extern unsigned long tlb_context_cache; | 19 | extern unsigned long tlb_context_cache; |
20 | extern unsigned long mmu_context_bmap[]; | 20 | extern unsigned long mmu_context_bmap[]; |
21 | 21 | ||
22 | DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm); | ||
22 | void get_new_mmu_context(struct mm_struct *mm); | 23 | void get_new_mmu_context(struct mm_struct *mm); |
23 | #ifdef CONFIG_SMP | 24 | #ifdef CONFIG_SMP |
24 | void smp_new_mmu_context_version(void); | 25 | void smp_new_mmu_context_version(void); |
@@ -76,8 +77,9 @@ void __flush_tlb_mm(unsigned long, unsigned long); | |||
76 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) | 77 | static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) |
77 | { | 78 | { |
78 | unsigned long ctx_valid, flags; | 79 | unsigned long ctx_valid, flags; |
79 | int cpu; | 80 | int cpu = smp_processor_id(); |
80 | 81 | ||
82 | per_cpu(per_cpu_secondary_mm, cpu) = mm; | ||
81 | if (unlikely(mm == &init_mm)) | 83 | if (unlikely(mm == &init_mm)) |
82 | return; | 84 | return; |
83 | 85 | ||
@@ -123,7 +125,6 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str | |||
123 | * for the first time, we must flush that context out of the | 125 | * for the first time, we must flush that context out of the |
124 | * local TLB. | 126 | * local TLB. |
125 | */ | 127 | */ |
126 | cpu = smp_processor_id(); | ||
127 | if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) { | 128 | if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) { |
128 | cpumask_set_cpu(cpu, mm_cpumask(mm)); | 129 | cpumask_set_cpu(cpu, mm_cpumask(mm)); |
129 | __flush_tlb_mm(CTX_HWBITS(mm->context), | 130 | __flush_tlb_mm(CTX_HWBITS(mm->context), |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 63b50447bb62..a4c0bc8af820 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -711,6 +711,7 @@ unsigned long tlb_context_cache = CTX_FIRST_VERSION; | |||
711 | #define MAX_CTX_NR (1UL << CTX_NR_BITS) | 711 | #define MAX_CTX_NR (1UL << CTX_NR_BITS) |
712 | #define CTX_BMAP_SLOTS BITS_TO_LONGS(MAX_CTX_NR) | 712 | #define CTX_BMAP_SLOTS BITS_TO_LONGS(MAX_CTX_NR) |
713 | DECLARE_BITMAP(mmu_context_bmap, MAX_CTX_NR); | 713 | DECLARE_BITMAP(mmu_context_bmap, MAX_CTX_NR); |
714 | DEFINE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm) = {0}; | ||
714 | 715 | ||
715 | /* Caller does TLB context flushing on local CPU if necessary. | 716 | /* Caller does TLB context flushing on local CPU if necessary. |
716 | * The caller also ensures that CTX_VALID(mm->context) is false. | 717 | * The caller also ensures that CTX_VALID(mm->context) is false. |