From: Nicholas Piggin <npiggin@gmail.com>
To: linux-mm@kvack.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 3/4] mm: allow arch to have tlb_flush caled on an empty TLB range
Date: Thu, 26 Jul 2018 00:06:40 +1000 [thread overview]
Message-ID: <20180725140641.30372-4-npiggin@gmail.com> (raw)
In-Reply-To: <20180725140641.30372-1-npiggin@gmail.com>
powerpc wants to de-couple page table caching structure flushes
from TLB flushes, which will make it possible to have mmu_gather
with freed page table pages but no TLB range. These must be sent
to tlb_flush, so allow the arch to specify when mmu_gather with
empty ranges should have tlb_flush called.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
include/asm-generic/tlb.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index b3353e21f3b3..b320c0cc8996 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -139,14 +139,27 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb)
}
}
+/*
+ * arch_tlb_mustflush specifies if tlb_flush is to be called even if the
+ * TLB range is empty (this can be the case for freeing page table pages
+ * if the arch does not adjust TLB range to cover them).
+ */
+#ifndef arch_tlb_mustflush
+#define arch_tlb_mustflush(tlb) false
+#endif
+
static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
{
- if (!tlb->end)
+ unsigned long start = tlb->start;
+ unsigned long end = tlb->end;
+
+ if (!(end || arch_tlb_mustflush(tlb)))
return;
tlb_flush(tlb);
- mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end);
__tlb_reset_range(tlb);
+ if (end)
+ mmu_notifier_invalidate_range(tlb->mm, start, end);
}
static inline void tlb_remove_page_size(struct mmu_gather *tlb,
--
2.17.0
next prev parent reply other threads:[~2018-07-25 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 14:06 [RFC PATCH 0/4] mm: mmu_gather changes to support explicit paging Nicholas Piggin
2018-07-25 14:06 ` [RFC PATCH 1/4] mm: move tlb_table_flush to tlb_flush_mmu_free Nicholas Piggin
2018-07-25 14:06 ` [RFC PATCH 2/4] mm: mmu_notifier fix for tlb_end_vma Nicholas Piggin
2018-07-25 14:06 ` Nicholas Piggin [this message]
2018-07-25 14:06 ` [RFC PATCH 4/4] powerpc/64s/radix: optimise TLB flush with precise TLB ranges in mmu_gather Nicholas Piggin
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=20180725140641.30372-4-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).