Commit b426e4bd authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Michael Ellerman

powerpc/mm: Use mm_is_thread_local() instread of open-coding

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 058ccc34
...@@ -1230,7 +1230,6 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, ...@@ -1230,7 +1230,6 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
unsigned long vsid; unsigned long vsid;
pte_t *ptep; pte_t *ptep;
unsigned hugeshift; unsigned hugeshift;
const struct cpumask *tmp;
int rc, user_region = 0; int rc, user_region = 0;
int psize, ssize; int psize, ssize;
...@@ -1282,8 +1281,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea, ...@@ -1282,8 +1281,7 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
} }
/* Check CPU locality */ /* Check CPU locality */
tmp = cpumask_of(smp_processor_id()); if (user_region && mm_is_thread_local(mm))
if (user_region && cpumask_equal(mm_cpumask(mm), tmp))
flags |= HPTE_LOCAL_UPDATE; flags |= HPTE_LOCAL_UPDATE;
#ifndef CONFIG_PPC_64K_PAGES #ifndef CONFIG_PPC_64K_PAGES
...@@ -1545,7 +1543,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, ...@@ -1545,7 +1543,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
#endif /* CONFIG_PPC_64K_PAGES */ #endif /* CONFIG_PPC_64K_PAGES */
/* Is that local to this CPU ? */ /* 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; update_flags |= HPTE_LOCAL_UPDATE;
/* Hash it in */ /* Hash it in */
......
...@@ -275,8 +275,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte) ...@@ -275,8 +275,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
batchp = &get_cpu_var(hugepd_freelist_cur); batchp = &get_cpu_var(hugepd_freelist_cur);
if (atomic_read(&tlb->mm->mm_users) < 2 || if (atomic_read(&tlb->mm->mm_users) < 2 ||
cpumask_equal(mm_cpumask(tlb->mm), mm_is_thread_local(tlb->mm)) {
cpumask_of(smp_processor_id()))) {
kmem_cache_free(hugepte_cache, hugepte); kmem_cache_free(hugepte_cache, hugepte);
put_cpu_var(hugepd_freelist_cur); put_cpu_var(hugepd_freelist_cur);
return; return;
......
...@@ -329,7 +329,6 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, ...@@ -329,7 +329,6 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
unsigned int psize; unsigned int psize;
unsigned long vsid; unsigned long vsid;
unsigned long flags = 0; unsigned long flags = 0;
const struct cpumask *tmp;
/* get the base page size,vsid and segment size */ /* get the base page size,vsid and segment size */
#ifdef CONFIG_DEBUG_VM #ifdef CONFIG_DEBUG_VM
...@@ -350,8 +349,7 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr, ...@@ -350,8 +349,7 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
ssize = mmu_kernel_ssize; ssize = mmu_kernel_ssize;
} }
tmp = cpumask_of(smp_processor_id()); if (mm_is_thread_local(mm))
if (cpumask_equal(mm_cpumask(mm), tmp))
flags |= HPTE_LOCAL_UPDATE; flags |= HPTE_LOCAL_UPDATE;
return flush_hash_hugepage(vsid, addr, pmdp, psize, ssize, flags); return flush_hash_hugepage(vsid, addr, pmdp, psize, ssize, flags);
......
...@@ -140,13 +140,10 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, ...@@ -140,13 +140,10 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
*/ */
void __flush_tlb_pending(struct ppc64_tlb_batch *batch) void __flush_tlb_pending(struct ppc64_tlb_batch *batch)
{ {
const struct cpumask *tmp; int i, local;
int i, local = 0;
i = batch->index; i = batch->index;
tmp = cpumask_of(smp_processor_id()); local = mm_is_thread_local(batch->mm);
if (cpumask_equal(mm_cpumask(batch->mm), tmp))
local = 1;
if (i == 1) if (i == 1)
flush_hash_page(batch->vpn[0], batch->pte[0], flush_hash_page(batch->vpn[0], batch->pte[0],
batch->psize, batch->ssize, local); batch->psize, batch->ssize, local);
......
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