lkml.org 
[lkml]   [2020]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] powerpc/nohash: Don't flush all TLBs when flushing one page
Date
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
\
 
 \ /
  Last update: 2020-01-31 16:38    [W:0.165 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site