From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev@lists.ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com, npiggin@gmail.com,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH 4/6] powerpc/mm: Use mm_is_thread_local() instread of open-coding
Date: Mon, 24 Jul 2017 14:28:01 +1000 [thread overview]
Message-ID: <20170724042803.25848-4-benh@kernel.crashing.org> (raw)
In-Reply-To: <20170724042803.25848-1-benh@kernel.crashing.org>
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>
---
arch/powerpc/mm/hash_utils_64.c | 6 ++----
arch/powerpc/mm/hugetlbpage.c | 3 +--
arch/powerpc/mm/pgtable-hash64.c | 4 +---
arch/powerpc/mm/tlb_hash64.c | 7 ++-----
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 7a20669c19e7..943d9fe2b9a3 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -1228,7 +1228,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;
@@ -1280,8 +1279,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
@@ -1543,7 +1541,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 */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index e1bf5ca397fe..122844c0734a 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -407,8 +407,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;
diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c
index 443a2c66a304..d89c637cb600 100644
--- a/arch/powerpc/mm/pgtable-hash64.c
+++ b/arch/powerpc/mm/pgtable-hash64.c
@@ -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);
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index b5b0fb97b9c0..4dde13d7452d 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -138,13 +138,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);
--
2.13.3
next prev parent reply other threads:[~2017-07-24 4:28 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 4:27 [PATCH 1/6] powerpc/mm: Move pgdir setting into a helper Benjamin Herrenschmidt
2017-07-24 4:27 ` [PATCH 2/6] powerpc/mm: Avoid double irq save/restore in activate_mm Benjamin Herrenschmidt
2017-07-24 4:28 ` [PATCH 3/6] powerpc/mm: Ensure cpumask update is ordered Benjamin Herrenschmidt
2017-07-24 11:20 ` Nicholas Piggin
2017-07-24 20:54 ` Benjamin Herrenschmidt
2017-08-11 11:06 ` Nicholas Piggin
2017-08-11 22:40 ` Benjamin Herrenschmidt
2017-08-17 12:58 ` Michael Ellerman
2017-08-23 12:01 ` [3/6] " Michael Ellerman
2017-07-24 4:28 ` Benjamin Herrenschmidt [this message]
2017-07-24 4:28 ` [PATCH 5/6] powerpc/mm: Optimize detection of thread local mm's Benjamin Herrenschmidt
2017-07-24 11:25 ` Nicholas Piggin
2017-07-24 13:46 ` Michael Ellerman
2017-07-25 0:34 ` Nicholas Piggin
2017-07-25 12:00 ` Michael Ellerman
2017-07-24 20:58 ` Benjamin Herrenschmidt
2017-07-25 0:44 ` Nicholas Piggin
2017-07-25 1:03 ` Benjamin Herrenschmidt
2017-07-25 10:55 ` Nicholas Piggin
2017-08-04 12:06 ` Frederic Barrat
2017-08-04 12:58 ` Benjamin Herrenschmidt
2017-08-21 17:27 ` Frederic Barrat
2017-08-21 17:35 ` Benjamin Herrenschmidt
2017-08-22 13:18 ` Frederic Barrat
2017-08-22 16:55 ` Benjamin Herrenschmidt
2017-08-24 16:40 ` Frederic Barrat
2017-08-24 18:47 ` Benjamin Herrenschmidt
2017-08-25 4:53 ` Frederic Barrat
2017-08-25 7:44 ` Benjamin Herrenschmidt
2017-08-25 8:03 ` Frederic Barrat
2017-08-22 4:28 ` Michael Ellerman
2017-07-24 4:28 ` [PATCH 6/6] powerpc/mm: Make switch_mm_irqs_off() out of line Benjamin Herrenschmidt
2017-08-24 12:37 ` [1/6] powerpc/mm: Move pgdir setting into a helper Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170724042803.25848-4-benh@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).