linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/nohash: Don't flush all TLBs when flushing one page
@ 2020-01-31 15:37 Christophe Leroy
  0 siblings, 0 replies; only message in thread
From: Christophe Leroy @ 2020-01-31 15:37 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

When flushing a range, the flushing function flushes all TLBs.

When the range is a single page, do a page flush instead.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/mm/nohash/tlb.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index 696f568253a0..3d05d70c54dc 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -362,13 +362,32 @@ void __init early_init_mmu_47x(void)
  */
 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
 {
+	int tsize = mmu_get_tsize(mmu_virtual_psize);
+
 #ifdef CONFIG_SMP
 	preempt_disable();
-	smp_call_function(do_flush_tlb_mm_ipi, NULL, 1);
-	_tlbil_pid(0);
+#endif
+	start = ALIGN_DOWN(start, PAGE_SIZE);
+	end = ALIGN(end, PAGE_SIZE);
+	if (end - start == PAGE_SIZE) {
+#ifdef CONFIG_SMP
+		struct tlb_flush_param p = {
+			.pid = 0,
+			.addr = start,
+			.tsize = tsize,
+			.ind = 0,
+		};
+		smp_call_function(do_flush_tlb_page_ipi, &p, 1);
+#endif
+		_tlbil_va(start, 0, tsize, 0);
+	} else {
+#ifdef CONFIG_SMP
+		smp_call_function(do_flush_tlb_mm_ipi, NULL, 1);
+#endif
+		_tlbil_pid(0);
+	}
+#ifdef CONFIG_SMP
 	preempt_enable();
-#else
-	_tlbil_pid(0);
 #endif
 }
 EXPORT_SYMBOL(flush_tlb_kernel_range);
-- 
2.25.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-31 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 15:37 [PATCH] powerpc/nohash: Don't flush all TLBs when flushing one page Christophe Leroy

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).