powerpc/nohash: Don't flush all TLBs when flushing one page
diff mbox series

Message ID 8cc8c64755ae63a6ef2b9808c1874664cdff8869.1580485010.git.christophe.leroy@c-s.fr
State Superseded
Headers show
Series
  • powerpc/nohash: Don't flush all TLBs when flushing one page
Related show

Checks

Context Check Description
snowpatch_ozlabs/needsstable success Patch has no Fixes tags
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (492a2f9203423062e77c862dd2256dc0e186690a)

Commit Message

Christophe Leroy Jan. 31, 2020, 3:37 p.m. UTC
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(-)

Patch
diff mbox series

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