powerpc/mm: Use mm_is_thread_local() instread of open-coding
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 24 Jul 2017 04:28:01 +0000 (14:28 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 23 Aug 2017 12:27:45 +0000 (22:27 +1000)
We open-code testing for the mm being local to the current CPU
in a few places. Use our existing helper instead.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/mm/pgtable-hash64.c
arch/powerpc/mm/tlb_hash64.c

index 1c4cd82421bcfc8148e3f47d5fd198b5827a70f2..67ec2e927253ef47077e3b7daf91ff8d3998ecd4 100644 (file)
@@ -1230,7 +1230,6 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
        unsigned long vsid;
        pte_t *ptep;
        unsigned hugeshift;
-       const struct cpumask *tmp;
        int rc, user_region = 0;
        int psize, ssize;
 
@@ -1282,8 +1281,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
        }
 
        /* Check CPU locality */
-       tmp = cpumask_of(smp_processor_id());
-       if (user_region && cpumask_equal(mm_cpumask(mm), tmp))
+       if (user_region && mm_is_thread_local(mm))
                flags |= HPTE_LOCAL_UPDATE;
 
 #ifndef CONFIG_PPC_64K_PAGES
@@ -1545,7 +1543,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
 #endif /* CONFIG_PPC_64K_PAGES */
 
        /* Is that local to this CPU ? */
-       if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
+       if (mm_is_thread_local(mm))
                update_flags |= HPTE_LOCAL_UPDATE;
 
        /* Hash it in */
index 2d4a331e498ee9b63f430b2f4c909f3cca20ffa5..1571a498a33fc6a688713f4f275b7b55cedabace 100644 (file)
@@ -275,8 +275,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
        batchp = &get_cpu_var(hugepd_freelist_cur);
 
        if (atomic_read(&tlb->mm->mm_users) < 2 ||
-           cpumask_equal(mm_cpumask(tlb->mm),
-                         cpumask_of(smp_processor_id()))) {
+           mm_is_thread_local(tlb->mm)) {
                kmem_cache_free(hugepte_cache, hugepte);
                put_cpu_var(hugepd_freelist_cur);
                return;
index c0a7372bdaa6ec2a3821990c9917349212d000f8..ec277913e01b4e06b1034531818b96c253004863 100644 (file)
@@ -329,7 +329,6 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
        unsigned int psize;
        unsigned long vsid;
        unsigned long flags = 0;
-       const struct cpumask *tmp;
 
        /* get the base page size,vsid and segment size */
 #ifdef CONFIG_DEBUG_VM
@@ -350,8 +349,7 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
                ssize = mmu_kernel_ssize;
        }
 
-       tmp = cpumask_of(smp_processor_id());
-       if (cpumask_equal(mm_cpumask(mm), tmp))
+       if (mm_is_thread_local(mm))
                flags |= HPTE_LOCAL_UPDATE;
 
        return flush_hash_hugepage(vsid, addr, pmdp, psize, ssize, flags);
index 71cb2742bd16123ef9f9d4b18e0ccc9bde51a951..881ebd53ffc27c8840ae57b088c4d247ba7ef191 100644 (file)
@@ -140,13 +140,10 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
  */
 void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
 {
-       const struct cpumask *tmp;
-       int i, local = 0;
+       int i, local;
 
        i = batch->index;
-       tmp = cpumask_of(smp_processor_id());
-       if (cpumask_equal(mm_cpumask(batch->mm), tmp))
-               local = 1;
+       local = mm_is_thread_local(batch->mm);
        if (i == 1)
                flush_hash_page(batch->vpn[0], batch->pte[0],
                                batch->psize, batch->ssize, local);