linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures
@ 2025-11-14 11:11 Qi Zheng
  2025-11-14 11:11 ` [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng

From: Qi Zheng <zhengqi.arch@bytedance.com>

Hi all,

This series aims to enable PT_RECLAIM on all 64-bit architectures.

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, we need to enable
PT_RECLAIM, which depends on MMU_GATHER_RCU_TABLE_FREE.

Therefore, this series first enables MMU_GATHER_RCU_TABLE_FREE on all 64-bit
architectures, and finally makes PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE
&& 64BIT. This way, PT_RECLAIM can be enabled by default on all 64-bit
architectures.

Comments and suggestions are welcome!

Thanks,
Qi

Qi Zheng (7):
  alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
  arc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  mips: mm: enable MMU_GATHER_RCU_TABLE_FREE
  parisc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  um: mm: enable MMU_GATHER_RCU_TABLE_FREE
  mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT

 arch/alpha/Kconfig                   | 1 +
 arch/alpha/include/asm/tlb.h         | 8 +++++---
 arch/arc/Kconfig                     | 1 +
 arch/arc/include/asm/pgalloc.h       | 9 ++++++---
 arch/loongarch/Kconfig               | 1 +
 arch/loongarch/include/asm/pgalloc.h | 6 ++++--
 arch/mips/Kconfig                    | 1 +
 arch/mips/include/asm/pgalloc.h      | 6 ++++--
 arch/parisc/Kconfig                  | 1 +
 arch/parisc/include/asm/tlb.h        | 6 ++++--
 arch/um/Kconfig                      | 1 +
 arch/x86/Kconfig                     | 1 -
 mm/Kconfig                           | 6 +-----
 13 files changed, 30 insertions(+), 18 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 19:13   ` Magnus Lindholm
  2025-11-14 11:11 ` [PATCH 2/7] arc: " Qi Zheng
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	Richard Henderson, Matt Turner

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Matt Turner <mattst88@gmail.com>
---
 arch/alpha/Kconfig           | 1 +
 arch/alpha/include/asm/tlb.h | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 80367f2cf821c..681ed894d9e72 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -40,6 +40,7 @@ config ALPHA
 	select MMU_GATHER_NO_RANGE
 	select SPARSEMEM_EXTREME if SPARSEMEM
 	select ZONE_DMA
+	select MMU_GATHER_RCU_TABLE_FREE
 	help
 	  The Alpha is a 64-bit general-purpose processor designed and
 	  marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/include/asm/tlb.h b/arch/alpha/include/asm/tlb.h
index 4f79e331af5ea..4fe5a901720f0 100644
--- a/arch/alpha/include/asm/tlb.h
+++ b/arch/alpha/include/asm/tlb.h
@@ -4,7 +4,9 @@
 
 #include <asm-generic/tlb.h>
 
-#define __pte_free_tlb(tlb, pte, address)		pte_free((tlb)->mm, pte)
-#define __pmd_free_tlb(tlb, pmd, address)		pmd_free((tlb)->mm, pmd)
- 
+#define __pte_free_tlb(tlb, pte, address)	\
+	tlb_remove_ptdesc((tlb), page_ptdesc(pte))
+#define __pmd_free_tlb(tlb, pmd, address)	\
+	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
+
 #endif
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/7] arc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
  2025-11-14 11:11 ` [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 11:20   ` Qi Zheng
  2025-11-14 11:11 ` [PATCH 3/7] loongarch: " Qi Zheng
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	Vineet Gupta

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: Vineet Gupta <vgupta@kernel.org>
---
 arch/arc/Kconfig               | 1 +
 arch/arc/include/asm/pgalloc.h | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index f27e6b90428e4..47db93952386d 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -54,6 +54,7 @@ config ARC
 	select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32
 	select TRACE_IRQFLAGS_SUPPORT
 	select HAVE_EBPF_JIT if ISA_ARCV2
+	select MMU_GATHER_RCU_TABLE_FREE
 
 config LOCKDEP_SUPPORT
 	def_bool y
diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h
index dfae070fe8d55..b1c6619435613 100644
--- a/arch/arc/include/asm/pgalloc.h
+++ b/arch/arc/include/asm/pgalloc.h
@@ -72,7 +72,8 @@ static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4dp, pud_t *pudp)
 	set_p4d(p4dp, __p4d((unsigned long)pudp));
 }
 
-#define __pud_free_tlb(tlb, pmd, addr)  pud_free((tlb)->mm, pmd)
+#define __pud_free_tlb(tlb, pud, addr)	\
+	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pud))
 
 #endif
 
@@ -83,10 +84,12 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmdp)
 	set_pud(pudp, __pud((unsigned long)pmdp));
 }
 
-#define __pmd_free_tlb(tlb, pmd, addr)  pmd_free((tlb)->mm, pmd)
+#define __pmd_free_tlb(tlb, pmd, addr)	\
+	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
 
 #endif
 
-#define __pte_free_tlb(tlb, pte, addr)  pte_free((tlb)->mm, pte)
+#define __pte_free_tlb(tlb, pte, addr)	\
+	tlb_remove_ptdesc((tlb), page_ptdesc(pte))
 
 #endif /* _ASM_ARC_PGALLOC_H */
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
  2025-11-14 11:11 ` [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
  2025-11-14 11:11 ` [PATCH 2/7] arc: " Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 14:17   ` Huacai Chen
  2025-11-14 11:11 ` [PATCH 4/7] mips: " Qi Zheng
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	Huacai Chen, WANG Xuerui

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
---
 arch/loongarch/Kconfig               | 1 +
 arch/loongarch/include/asm/pgalloc.h | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 5b1116733d881..3bf2f2a9cd647 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -210,6 +210,7 @@ config LOONGARCH
 	select USER_STACKTRACE_SUPPORT
 	select VDSO_GETRANDOM
 	select ZONE_DMA32
+	select MMU_GATHER_RCU_TABLE_FREE
 
 config 32BIT
 	bool
diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h
index 1c63a9d9a6d35..0539d04bf1525 100644
--- a/arch/loongarch/include/asm/pgalloc.h
+++ b/arch/loongarch/include/asm/pgalloc.h
@@ -79,7 +79,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
 
@@ -99,7 +100,8 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
 	return 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



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/7] mips: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
                   ` (2 preceding siblings ...)
  2025-11-14 11:11 ` [PATCH 3/7] loongarch: " Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 11:11 ` [PATCH 5/7] parisc: " Qi Zheng
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	Thomas Bogendoerfer

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.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



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/7] parisc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
                   ` (3 preceding siblings ...)
  2025-11-14 11:11 ` [PATCH 4/7] mips: " Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 11:11 ` [PATCH 6/7] um: " Qi Zheng
  2025-11-14 11:11 ` [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT Qi Zheng
  6 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	James E.J. Bottomley, Helge Deller

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
---
 arch/parisc/Kconfig           | 1 +
 arch/parisc/include/asm/tlb.h | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47fd9662d8005..946cbe21a4118 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -92,6 +92,7 @@ config PARISC
 	select TRACE_IRQFLAGS_SUPPORT
 	select HAVE_FUNCTION_DESCRIPTORS if 64BIT
 	select PCI_MSI_ARCH_FALLBACKS if PCI_MSI
+	select MMU_GATHER_RCU_TABLE_FREE
 
 	help
 	  The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/include/asm/tlb.h b/arch/parisc/include/asm/tlb.h
index 44235f367674d..ab7d4113df61a 100644
--- a/arch/parisc/include/asm/tlb.h
+++ b/arch/parisc/include/asm/tlb.h
@@ -5,8 +5,10 @@
 #include <asm-generic/tlb.h>
 
 #if CONFIG_PGTABLE_LEVELS == 3
-#define __pmd_free_tlb(tlb, pmd, addr)	pmd_free((tlb)->mm, pmd)
+#define __pmd_free_tlb(tlb, pmd, addr)	\
+	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
 #endif
-#define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, pte)
+#define __pte_free_tlb(tlb, pte, addr)	\
+	tlb_remove_ptdesc((tlb), page_ptdesc(pte))
 
 #endif
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/7] um: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
                   ` (4 preceding siblings ...)
  2025-11-14 11:11 ` [PATCH 5/7] parisc: " Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-14 11:11 ` [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT Qi Zheng
  6 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng,
	Richard Weinberger, Anton Ivanov, Johannes Berg

From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
---
 arch/um/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 097c6a6265ef3..47a41bc77bb24 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -41,6 +41,7 @@ config UML
 	select HAVE_SYSCALL_TRACEPOINTS
 	select THREAD_INFO_IN_TASK
 	select SPARSE_IRQ
+	select MMU_GATHER_RCU_TABLE_FREE
 
 config MMU
 	bool
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT
  2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
                   ` (5 preceding siblings ...)
  2025-11-14 11:11 ` [PATCH 6/7] um: " Qi Zheng
@ 2025-11-14 11:11 ` Qi Zheng
  2025-11-15  0:51   ` kernel test robot
  2025-11-15  1:12   ` kernel test robot
  6 siblings, 2 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:11 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Qi Zheng

From: Qi Zheng <zhengqi.arch@bytedance.com>

Make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE so that PT_RECLAIM can
be enabled by default on all architectures that support
MMU_GATHER_RCU_TABLE_FREE.

Considering that a large number of PTE page table pages (such as 100GB+)
can only be caused on a 64-bit system, let PT_RECLAIM also depend on
64BIT.

Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
 arch/x86/Kconfig | 1 -
 mm/Kconfig       | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index eac2e86056902..96bff81fd4787 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -330,7 +330,6 @@ config X86
 	select FUNCTION_ALIGNMENT_4B
 	imply IMA_SECURE_AND_OR_TRUSTED_BOOT    if EFI
 	select HAVE_DYNAMIC_FTRACE_NO_PATCHABLE
-	select ARCH_SUPPORTS_PT_RECLAIM		if X86_64
 	select ARCH_SUPPORTS_SCHED_SMT		if SMP
 	select SCHED_SMT			if SMP
 	select ARCH_SUPPORTS_SCHED_CLUSTER	if SMP
diff --git a/mm/Kconfig b/mm/Kconfig
index a5a90b169435d..e795fbd69e50c 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1440,14 +1440,10 @@ config ARCH_HAS_USER_SHADOW_STACK
 	  The architecture has hardware support for userspace shadow call
           stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
 
-config ARCH_SUPPORTS_PT_RECLAIM
-	def_bool n
-
 config PT_RECLAIM
 	bool "reclaim empty user page table pages"
 	default y
-	depends on ARCH_SUPPORTS_PT_RECLAIM && MMU && SMP
-	select MMU_GATHER_RCU_TABLE_FREE
+	depends on MMU_GATHER_RCU_TABLE_FREE && MMU && SMP && 64BIT
 	help
 	  Try to reclaim empty user page table pages in paths other than munmap
 	  and exit_mmap path.
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/7] arc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 ` [PATCH 2/7] arc: " Qi Zheng
@ 2025-11-14 11:20   ` Qi Zheng
  2025-11-14 23:10     ` Vineet Gupta
  0 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 11:20 UTC (permalink / raw)
  To: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Vineet Gupta



On 11/14/25 7:11 PM, Qi Zheng wrote:
> From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
> Cc: Vineet Gupta <vgupta@kernel.org>
> ---
>   arch/arc/Kconfig               | 1 +
>   arch/arc/include/asm/pgalloc.h | 9 ++++++---
>   2 files changed, 7 insertions(+), 3 deletions(-)

Strangely, it seems that only ARC does not define CONFIG_64BIT?

Does the ARC architecture support 64-bit? Did I miss something?

> 
> diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
> index f27e6b90428e4..47db93952386d 100644
> --- a/arch/arc/Kconfig
> +++ b/arch/arc/Kconfig
> @@ -54,6 +54,7 @@ config ARC
>   	select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32
>   	select TRACE_IRQFLAGS_SUPPORT
>   	select HAVE_EBPF_JIT if ISA_ARCV2
> +	select MMU_GATHER_RCU_TABLE_FREE
>   
>   config LOCKDEP_SUPPORT
>   	def_bool y
> diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h
> index dfae070fe8d55..b1c6619435613 100644
> --- a/arch/arc/include/asm/pgalloc.h
> +++ b/arch/arc/include/asm/pgalloc.h
> @@ -72,7 +72,8 @@ static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4dp, pud_t *pudp)
>   	set_p4d(p4dp, __p4d((unsigned long)pudp));
>   }
>   
> -#define __pud_free_tlb(tlb, pmd, addr)  pud_free((tlb)->mm, pmd)
> +#define __pud_free_tlb(tlb, pud, addr)	\
> +	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pud))
>   
>   #endif
>   
> @@ -83,10 +84,12 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmdp)
>   	set_pud(pudp, __pud((unsigned long)pmdp));
>   }
>   
> -#define __pmd_free_tlb(tlb, pmd, addr)  pmd_free((tlb)->mm, pmd)
> +#define __pmd_free_tlb(tlb, pmd, addr)	\
> +	tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
>   
>   #endif
>   
> -#define __pte_free_tlb(tlb, pte, addr)  pte_free((tlb)->mm, pte)
> +#define __pte_free_tlb(tlb, pte, addr)	\
> +	tlb_remove_ptdesc((tlb), page_ptdesc(pte))
>   
>   #endif /* _ASM_ARC_PGALLOC_H */



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 ` [PATCH 3/7] loongarch: " Qi Zheng
@ 2025-11-14 14:17   ` Huacai Chen
  2025-11-14 15:55     ` Qi Zheng
  2025-11-17  6:41     ` Qi Zheng
  0 siblings, 2 replies; 19+ messages in thread
From: Huacai Chen @ 2025-11-14 14:17 UTC (permalink / raw)
  To: Qi Zheng
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, WANG Xuerui

Hi, Qi Zheng,

We usually use LoongArch rather than loongarch, but if you want to
keep consistency for all patches, just do it.

On Fri, Nov 14, 2025 at 7:13 PM Qi Zheng <qi.zheng@linux.dev> wrote:
>
> From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> ---
>  arch/loongarch/Kconfig               | 1 +
>  arch/loongarch/include/asm/pgalloc.h | 6 ++++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 5b1116733d881..3bf2f2a9cd647 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -210,6 +210,7 @@ config LOONGARCH
>         select USER_STACKTRACE_SUPPORT
>         select VDSO_GETRANDOM
>         select ZONE_DMA32
> +       select MMU_GATHER_RCU_TABLE_FREE
Please use alpha-betical order.

>
>  config 32BIT
>         bool
> diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h
> index 1c63a9d9a6d35..0539d04bf1525 100644
> --- a/arch/loongarch/include/asm/pgalloc.h
> +++ b/arch/loongarch/include/asm/pgalloc.h
> @@ -79,7 +79,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))
I think we can define it in one line.

>
>  #endif
>
> @@ -99,7 +100,8 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
>         return 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))
The same.

Other patches have the same problem.

Huacai

>
>  #endif /* __PAGETABLE_PUD_FOLDED */
>
> --
> 2.20.1
>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 14:17   ` Huacai Chen
@ 2025-11-14 15:55     ` Qi Zheng
  2025-11-17  6:41     ` Qi Zheng
  1 sibling, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-14 15:55 UTC (permalink / raw)
  To: Huacai Chen
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, WANG Xuerui

Hi Huacai,

On 11/14/25 10:17 PM, Huacai Chen wrote:
> Hi, Qi Zheng,
> 
> We usually use LoongArch rather than loongarch, but if you want to
> keep consistency for all patches, just do it.

OK, will change to use LoongArch.

> 
> On Fri, Nov 14, 2025 at 7:13 PM Qi Zheng <qi.zheng@linux.dev> wrote:
>>
>> From: Qi Zheng <zhengqi.arch@bytedance.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@bytedance.com>
>> Cc: Huacai Chen <chenhuacai@kernel.org>
>> Cc: WANG Xuerui <kernel@xen0n.name>
>> ---
>>   arch/loongarch/Kconfig               | 1 +
>>   arch/loongarch/include/asm/pgalloc.h | 6 ++++--
>>   2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
>> index 5b1116733d881..3bf2f2a9cd647 100644
>> --- a/arch/loongarch/Kconfig
>> +++ b/arch/loongarch/Kconfig
>> @@ -210,6 +210,7 @@ config LOONGARCH
>>          select USER_STACKTRACE_SUPPORT
>>          select VDSO_GETRANDOM
>>          select ZONE_DMA32
>> +       select MMU_GATHER_RCU_TABLE_FREE
> Please use alpha-betical order.

OK, will do.

> 
>>
>>   config 32BIT
>>          bool
>> diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h
>> index 1c63a9d9a6d35..0539d04bf1525 100644
>> --- a/arch/loongarch/include/asm/pgalloc.h
>> +++ b/arch/loongarch/include/asm/pgalloc.h
>> @@ -79,7 +79,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))
> I think we can define it in one line.

will do.

> 
>>
>>   #endif
>>
>> @@ -99,7 +100,8 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
>>          return 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))
> The same.
> 
> Other patches have the same problem.

Got it, will convert them all to the one-line type.

Thanks,
Qi

> 
> Huacai
> 
>>
>>   #endif /* __PAGETABLE_PUD_FOLDED */
>>
>> --
>> 2.20.1
>>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:11 ` [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
@ 2025-11-14 19:13   ` Magnus Lindholm
  2025-11-15  9:06     ` Qi Zheng
  0 siblings, 1 reply; 19+ messages in thread
From: Magnus Lindholm @ 2025-11-14 19:13 UTC (permalink / raw)
  To: Qi Zheng
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, Richard Henderson, Matt Turner

Hi,

I applied your patches to a fresh pull of torvalds/linux.git repo but was unable
to build the kernel (on Alpha) with this patch applied.

I made the following changes in order to get it to build on Alpha:

diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c
index 7e9455a18aae..6761b0c282bf 100644
--- a/mm/pt_reclaim.c
+++ b/mm/pt_reclaim.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/hugetlb.h>
-#include <asm-generic/tlb.h>
 #include <asm/pgalloc.h>
+#include <asm/tlb.h>

 #include "internal.h"


/Magnus


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/7] arc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 11:20   ` Qi Zheng
@ 2025-11-14 23:10     ` Vineet Gupta
  2025-11-15  9:08       ` Qi Zheng
  0 siblings, 1 reply; 19+ messages in thread
From: Vineet Gupta @ 2025-11-14 23:10 UTC (permalink / raw)
  To: Qi Zheng, will, aneesh.kumar, npiggin, peterz, dev.jain, akpm,
	david, ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um, Vineet Gupta

On 11/14/25 03:20, Qi Zheng wrote:
> Strangely, it seems that only ARC does not define CONFIG_64BIT?
>
> Does the ARC architecture support 64-bit? Did I miss something?

ARC is 32-bit only !

-Vineet


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT
  2025-11-14 11:11 ` [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT Qi Zheng
@ 2025-11-15  0:51   ` kernel test robot
  2025-11-15  1:12   ` kernel test robot
  1 sibling, 0 replies; 19+ messages in thread
From: kernel test robot @ 2025-11-15  0:51 UTC (permalink / raw)
  To: Qi Zheng, will, aneesh.kumar, npiggin, peterz, dev.jain, akpm,
	david, ioworker0
  Cc: oe-kbuild-all, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng

Hi Qi,

kernel test robot noticed the following build errors:

[auto build test ERROR on deller-parisc/for-next]
[also build test ERROR on uml/next tip/x86/core akpm-mm/mm-everything linus/master v6.18-rc5 next-20251114]
[cannot apply to uml/fixes vgupta-arc/for-next vgupta-arc/for-curr]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Qi-Zheng/alpha-mm-enable-MMU_GATHER_RCU_TABLE_FREE/20251114-191543
base:   https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git for-next
patch link:    https://lore.kernel.org/r/0a4d1e6f0bf299cafd1fc624f965bd1ca542cea8.1763117269.git.zhengqi.arch%40bytedance.com
patch subject: [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT
config: arm64-randconfig-004-20251115 (https://download.01.org/0day-ci/archive/20251115/202511150845.XqOxPJxe-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251115/202511150845.XqOxPJxe-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511150845.XqOxPJxe-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from mm/pt_reclaim.c:3:
   mm/pt_reclaim.c: In function 'free_pte':
>> include/asm-generic/tlb.h:731:3: error: implicit declaration of function '__pte_free_tlb'; did you mean 'pte_free_tlb'? [-Werror=implicit-function-declaration]
      __pte_free_tlb(tlb, ptep, address);  \
      ^~~~~~~~~~~~~~
   mm/pt_reclaim.c:31:2: note: in expansion of macro 'pte_free_tlb'
     pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);
     ^~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +731 include/asm-generic/tlb.h

a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  701  
a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  702  #define tlb_remove_pud_tlb_entry(tlb, pudp, address)			\
a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  703  	do {								\
2631ed00b04988 Peter Zijlstra (Intel  2020-06-25  704) 		tlb_flush_pud_range(tlb, address, HPAGE_PUD_SIZE);	\
a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  705  		__tlb_remove_pud_tlb_entry(tlb, pudp, address);		\
a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  706  	} while (0)
a00cc7d9dd93d6 Matthew Wilcox         2017-02-24  707  
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  708  /*
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  709   * For things like page tables caches (ie caching addresses "inside" the
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  710   * page tables, like x86 does), for legacy reasons, flushing an
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  711   * individual page had better flush the page table caches behind it. This
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  712   * is definitely how x86 works, for example. And if you have an
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  713   * architected non-legacy page table cache (which I'm not aware of
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  714   * anybody actually doing), you're going to have some architecturally
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  715   * explicit flushing for that, likely *separate* from a regular TLB entry
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  716   * flush, and thus you'd need more than just some range expansion..
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  717   *
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  718   * So if we ever find an architecture
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  719   * that would want something that odd, I think it is up to that
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  720   * architecture to do its own odd thing, not cause pain for others
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  721   * http://lkml.kernel.org/r/CA+55aFzBggoXtNXQeng5d_mRoDnaMBE5Y+URs+PHR67nUpMtaw@mail.gmail.com
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  722   *
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  723   * For now w.r.t page table cache, mark the range_size as PAGE_SIZE
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  724   */
b5bc66b7131087 Aneesh Kumar K.V       2016-12-12  725  
a90744bac57c3c Nicholas Piggin        2018-07-13  726  #ifndef pte_free_tlb
9e1b32caa525cb Benjamin Herrenschmidt 2009-07-22  727  #define pte_free_tlb(tlb, ptep, address)			\
^1da177e4c3f41 Linus Torvalds         2005-04-16  728  	do {							\
2631ed00b04988 Peter Zijlstra (Intel  2020-06-25  729) 		tlb_flush_pmd_range(tlb, address, PAGE_SIZE);	\
22a61c3c4f1379 Peter Zijlstra         2018-08-23  730  		tlb->freed_tables = 1;				\
9e1b32caa525cb Benjamin Herrenschmidt 2009-07-22 @731  		__pte_free_tlb(tlb, ptep, address);		\
^1da177e4c3f41 Linus Torvalds         2005-04-16  732  	} while (0)
a90744bac57c3c Nicholas Piggin        2018-07-13  733  #endif
^1da177e4c3f41 Linus Torvalds         2005-04-16  734  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT
  2025-11-14 11:11 ` [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT Qi Zheng
  2025-11-15  0:51   ` kernel test robot
@ 2025-11-15  1:12   ` kernel test robot
  1 sibling, 0 replies; 19+ messages in thread
From: kernel test robot @ 2025-11-15  1:12 UTC (permalink / raw)
  To: Qi Zheng, will, aneesh.kumar, npiggin, peterz, dev.jain, akpm,
	david, ioworker0
  Cc: llvm, oe-kbuild-all, linux-arch, linux-kernel, linux-mm,
	linux-alpha, linux-snps-arc, loongarch, linux-mips, linux-parisc,
	linux-um, Qi Zheng

Hi Qi,

kernel test robot noticed the following build errors:

[auto build test ERROR on deller-parisc/for-next]
[also build test ERROR on uml/next tip/x86/core akpm-mm/mm-everything linus/master v6.18-rc5 next-20251114]
[cannot apply to uml/fixes vgupta-arc/for-next vgupta-arc/for-curr]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Qi-Zheng/alpha-mm-enable-MMU_GATHER_RCU_TABLE_FREE/20251114-191543
base:   https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git for-next
patch link:    https://lore.kernel.org/r/0a4d1e6f0bf299cafd1fc624f965bd1ca542cea8.1763117269.git.zhengqi.arch%40bytedance.com
patch subject: [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT
config: arm64-randconfig-002-20251115 (https://download.01.org/0day-ci/archive/20251115/202511150832.iAyO0SAW-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251115/202511150832.iAyO0SAW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511150832.iAyO0SAW-lkp@intel.com/

All errors (new ones prefixed by >>):

>> mm/pt_reclaim.c:31:2: error: call to undeclared function '__pte_free_tlb'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      31 |         pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);
         |         ^
   include/asm-generic/tlb.h:731:3: note: expanded from macro 'pte_free_tlb'
     731 |                 __pte_free_tlb(tlb, ptep, address);             \
         |                 ^
   1 error generated.


vim +/__pte_free_tlb +31 mm/pt_reclaim.c

6375e95f381e3d Qi Zheng 2024-12-04  27  
6375e95f381e3d Qi Zheng 2024-12-04  28  void free_pte(struct mm_struct *mm, unsigned long addr, struct mmu_gather *tlb,
6375e95f381e3d Qi Zheng 2024-12-04  29  	      pmd_t pmdval)
6375e95f381e3d Qi Zheng 2024-12-04  30  {
6375e95f381e3d Qi Zheng 2024-12-04 @31  	pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);
6375e95f381e3d Qi Zheng 2024-12-04  32  	mm_dec_nr_ptes(mm);
6375e95f381e3d Qi Zheng 2024-12-04  33  }
6375e95f381e3d Qi Zheng 2024-12-04  34  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 19:13   ` Magnus Lindholm
@ 2025-11-15  9:06     ` Qi Zheng
  0 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-15  9:06 UTC (permalink / raw)
  To: Magnus Lindholm
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, Richard Henderson, Matt Turner

Hi Magnus,

On 11/15/25 3:13 AM, Magnus Lindholm wrote:
> Hi,
> 
> I applied your patches to a fresh pull of torvalds/linux.git repo but was unable
> to build the kernel (on Alpha) with this patch applied.
> 
> I made the following changes in order to get it to build on Alpha:

Thanks! Will fix it in the next version.

> 
> diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c
> index 7e9455a18aae..6761b0c282bf 100644
> --- a/mm/pt_reclaim.c
> +++ b/mm/pt_reclaim.c
> @@ -1,7 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0
>   #include <linux/hugetlb.h>
> -#include <asm-generic/tlb.h>
>   #include <asm/pgalloc.h>
> +#include <asm/tlb.h>
> 
>   #include "internal.h"
> 
> 
> /Magnus



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/7] arc: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 23:10     ` Vineet Gupta
@ 2025-11-15  9:08       ` Qi Zheng
  0 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2025-11-15  9:08 UTC (permalink / raw)
  To: Vineet Gupta, will, aneesh.kumar, npiggin, peterz, dev.jain, akpm,
	david, ioworker0
  Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, linux-snps-arc,
	loongarch, linux-mips, linux-parisc, linux-um



On 11/15/25 7:10 AM, Vineet Gupta wrote:
> On 11/14/25 03:20, Qi Zheng wrote:
>> Strangely, it seems that only ARC does not define CONFIG_64BIT?
>>
>> Does the ARC architecture support 64-bit? Did I miss something?
> 
> ARC is 32-bit only !

Got it! Will drop this patch in the next version.

Thanks!

> 
> -Vineet



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-14 14:17   ` Huacai Chen
  2025-11-14 15:55     ` Qi Zheng
@ 2025-11-17  6:41     ` Qi Zheng
  2025-11-17  6:57       ` Huacai Chen
  1 sibling, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2025-11-17  6:41 UTC (permalink / raw)
  To: Huacai Chen
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, WANG Xuerui

Hi Huacai,

On 11/14/25 10:17 PM, Huacai Chen wrote:
> Hi, Qi Zheng,

[...]

>>
>> -#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))
> I think we can define it in one line.

Do we need to change __pte_free_tlb() to a single-line format
as well?

Thanks,
Qi


>>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE
  2025-11-17  6:41     ` Qi Zheng
@ 2025-11-17  6:57       ` Huacai Chen
  0 siblings, 0 replies; 19+ messages in thread
From: Huacai Chen @ 2025-11-17  6:57 UTC (permalink / raw)
  To: Qi Zheng
  Cc: will, aneesh.kumar, npiggin, peterz, dev.jain, akpm, david,
	ioworker0, linux-arch, linux-kernel, linux-mm, linux-alpha,
	linux-snps-arc, loongarch, linux-mips, linux-parisc, linux-um,
	Qi Zheng, WANG Xuerui

On Mon, Nov 17, 2025 at 2:42 PM Qi Zheng <qi.zheng@linux.dev> wrote:
>
> Hi Huacai,
>
> On 11/14/25 10:17 PM, Huacai Chen wrote:
> > Hi, Qi Zheng,
>
> [...]
>
> >>
> >> -#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))
> > I think we can define it in one line.
>
> Do we need to change __pte_free_tlb() to a single-line format
> as well?
Yes, there is no 80 columns limit now.

Huacai

>
> Thanks,
> Qi
>
>
> >>
>
>


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-11-17  6:57 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14 11:11 [PATCH 0/7] enable PT_RECLAIM on all 64-bit architectures Qi Zheng
2025-11-14 11:11 ` [PATCH 1/7] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
2025-11-14 19:13   ` Magnus Lindholm
2025-11-15  9:06     ` Qi Zheng
2025-11-14 11:11 ` [PATCH 2/7] arc: " Qi Zheng
2025-11-14 11:20   ` Qi Zheng
2025-11-14 23:10     ` Vineet Gupta
2025-11-15  9:08       ` Qi Zheng
2025-11-14 11:11 ` [PATCH 3/7] loongarch: " Qi Zheng
2025-11-14 14:17   ` Huacai Chen
2025-11-14 15:55     ` Qi Zheng
2025-11-17  6:41     ` Qi Zheng
2025-11-17  6:57       ` Huacai Chen
2025-11-14 11:11 ` [PATCH 4/7] mips: " Qi Zheng
2025-11-14 11:11 ` [PATCH 5/7] parisc: " Qi Zheng
2025-11-14 11:11 ` [PATCH 6/7] um: " Qi Zheng
2025-11-14 11:11 ` [PATCH 7/7] mm: make PT_RECLAIM depend on MMU_GATHER_RCU_TABLE_FREE && 64BIT Qi Zheng
2025-11-15  0:51   ` kernel test robot
2025-11-15  1:12   ` kernel test robot

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