[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d69204bb10f4d08eb5d5ae673d2329e7df44af72.1763117269.git.zhengqi.arch@bytedance.com>
Date: Fri, 14 Nov 2025 19:11:18 +0800
From: Qi Zheng <qi.zheng@...ux.dev>
To: will@...nel.org,
aneesh.kumar@...nel.org,
npiggin@...il.com,
peterz@...radead.org,
dev.jain@....com,
akpm@...ux-foundation.org,
david@...hat.com,
ioworker0@...il.com
Cc: linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
linux-alpha@...r.kernel.org,
linux-snps-arc@...ts.infradead.org,
loongarch@...ts.linux.dev,
linux-mips@...r.kernel.org,
linux-parisc@...r.kernel.org,
linux-um@...ts.infradead.org,
Qi Zheng <zhengqi.arch@...edance.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Subject: [PATCH 4/7] mips: mm: enable MMU_GATHER_RCU_TABLE_FREE
From: Qi Zheng <zhengqi.arch@...edance.com>
On a 64-bit system, madvise(MADV_DONTNEED) may cause a large number of
empty PTE page table pages (such as 100GB+). To resolve this problem,
first enable MMU_GATHER_RCU_TABLE_FREE to prepare for enabling the
PT_RECLAIM feature, which resolves this problem.
Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
---
arch/mips/Kconfig | 1 +
arch/mips/include/asm/pgalloc.h | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e8683f58fd3e2..0ee8820a354c4 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -108,6 +108,7 @@ config MIPS
select TRACE_IRQFLAGS_SUPPORT
select ARCH_HAS_ELFCORE_COMPAT
select HAVE_ARCH_KCSAN if 64BIT
+ select MMU_GATHER_RCU_TABLE_FREE
config MIPS_FIXUP_BIGPHYS_ADDR
bool
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 942af87f1cddb..c00f445045f43 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -72,7 +72,8 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
return pmd;
}
-#define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x)
+#define __pmd_free_tlb(tlb, x, addr) \
+ tlb_remove_ptdesc((tlb), virt_to_ptdesc(x))
#endif
@@ -98,7 +99,8 @@ static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4d, pud_t *pud)
set_p4d(p4d, __p4d((unsigned long)pud));
}
-#define __pud_free_tlb(tlb, x, addr) pud_free((tlb)->mm, x)
+#define __pud_free_tlb(tlb, x, addr) \
+ tlb_remove_ptdesc((tlb), virt_to_ptdesc(x))
#endif /* __PAGETABLE_PUD_FOLDED */
--
2.20.1
Powered by blists - more mailing lists