]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
MIPS: mm: Consolidate drop_mmu_context() has-ASID checks
authorPaul Burton <paul.burton@mips.com>
Sat, 2 Feb 2019 01:43:19 +0000 (01:43 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 4 Feb 2019 18:56:18 +0000 (10:56 -0800)
If an mm does not have an ASID on the local CPU then drop_mmu_context()
is always redundant, since there's no context to "drop". Various callers
of drop_mmu_context() check whether the mm has been allocated an ASID
before making the call. Move that check into drop_mmu_context() and
remove it from callers to simplify them.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
arch/mips/include/asm/mmu_context.h
arch/mips/mm/c-r4k.c
arch/mips/mm/tlb-r3k.c
arch/mips/mm/tlb-r4k.c
arch/mips/mm/tlb-r8k.c

index 5d0a73a5cf40b833d3da3a4866b57850bcf552af..1b8392dcd35456898fe78dfc2cf29700fab446b7 100644 (file)
@@ -186,7 +186,9 @@ drop_mmu_context(struct mm_struct *mm)
        local_irq_save(flags);
 
        cpu = smp_processor_id();
-       if (cpumask_test_cpu(cpu, mm_cpumask(mm)))  {
+       if (!cpu_context(cpu, mm)) {
+               /* no-op */
+       } else if (cpumask_test_cpu(cpu, mm_cpumask(mm)))  {
                htw_stop();
                get_new_mmu_context(mm);
                write_c0_entryhi(cpu_asid(cpu, mm));
index 1eca2b7e8a28ed4510e8e76d243bc2583aa09d14..248d9e8263cfb5f1091c74e15135a2dff991cc60 100644 (file)
@@ -697,10 +697,7 @@ static inline void local_r4k_flush_cache_page(void *args)
        }
        if (exec) {
                if (vaddr && cpu_has_vtag_icache && mm == current->active_mm) {
-                       int cpu = smp_processor_id();
-
-                       if (cpu_context(cpu, mm) != 0)
-                               drop_mmu_context(mm);
+                       drop_mmu_context(mm);
                } else
                        vaddr ? r4k_blast_icache_page(addr) :
                                r4k_blast_icache_user_page(addr);
index 05a5ddccd9da35a2cf0a515d23ea69dc1330de47..60eb7a1144403f30efaacf188ac983aba642c707 100644 (file)
@@ -69,14 +69,14 @@ void local_flush_tlb_all(void)
 
 void local_flush_tlb_mm(struct mm_struct *mm)
 {
+#ifdef DEBUG_TLB
        int cpu = smp_processor_id();
 
-       if (cpu_context(cpu, mm) != 0) {
-#ifdef DEBUG_TLB
+       if (cpu_context(cpu, mm) != 0)
                printk("[tlbmm<%lu>]", (unsigned long)cpu_context(cpu, mm));
 #endif
-               drop_mmu_context(mm);
-       }
+
+       drop_mmu_context(mm);
 }
 
 void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
index 6c99dfff71b286ee0f5a5d774822ce048714eee9..ba76b0c11d38f566b5631dfd84ecd3c5a3295dac 100644 (file)
@@ -108,16 +108,8 @@ EXPORT_SYMBOL(local_flush_tlb_all);
    these entries, we just bump the asid. */
 void local_flush_tlb_mm(struct mm_struct *mm)
 {
-       int cpu;
-
        preempt_disable();
-
-       cpu = smp_processor_id();
-
-       if (cpu_context(cpu, mm) != 0) {
-               drop_mmu_context(mm);
-       }
-
+       drop_mmu_context(mm);
        preempt_enable();
 }
 
index 20fa35d21776a1837f123f52ce49ea0c8849a84b..c938d6b497ef111f2ec8ad91574af34eccdbfd70 100644 (file)
@@ -52,10 +52,7 @@ void local_flush_tlb_all(void)
 
 void local_flush_tlb_mm(struct mm_struct *mm)
 {
-       int cpu = smp_processor_id();
-
-       if (cpu_context(cpu, mm) != 0)
-               drop_mmu_context(mm);
+       drop_mmu_context(mm);
 }
 
 void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,