Skip to content

Commit 7a5b4bb

Browse files
Pavel Tatashindavem330
authored andcommitted
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>
1 parent c441523 commit 7a5b4bb

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎arch/sparc/include/asm/mmu_context_64.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extern spinlock_t ctx_alloc_lock;
1919
extern unsigned long tlb_context_cache;
2020
extern unsigned long mmu_context_bmap[];
2121

22+
DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm);
2223
void get_new_mmu_context(struct mm_struct *mm);
2324
#ifdef CONFIG_SMP
2425
void smp_new_mmu_context_version(void);
@@ -76,8 +77,9 @@ void __flush_tlb_mm(unsigned long, unsigned long);
7677
static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
7778
{
7879
unsigned long ctx_valid, flags;
79-
int cpu;
80+
int cpu = smp_processor_id();
8081

82+
per_cpu(per_cpu_secondary_mm, cpu) = mm;
8183
if (unlikely(mm == &init_mm))
8284
return;
8385

@@ -123,7 +125,6 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
123125
* for the first time, we must flush that context out of the
124126
* local TLB.
125127
*/
126-
cpu = smp_processor_id();
127128
if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) {
128129
cpumask_set_cpu(cpu, mm_cpumask(mm));
129130
__flush_tlb_mm(CTX_HWBITS(mm->context),

‎arch/sparc/mm/init_64.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ unsigned long tlb_context_cache = CTX_FIRST_VERSION;
711711
#define MAX_CTX_NR (1UL << CTX_NR_BITS)
712712
#define CTX_BMAP_SLOTS BITS_TO_LONGS(MAX_CTX_NR)
713713
DECLARE_BITMAP(mmu_context_bmap, MAX_CTX_NR);
714+
DEFINE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm) = {0};
714715

715716
/* Caller does TLB context flushing on local CPU if necessary.
716717
* The caller also ensures that CTX_VALID(mm->context) is false.

0 commit comments

Comments
 (0)