* [PATCH v4 1/8] mm: change mm/pt_reclaim.c to use asm/tlb.h instead of asm-generic/tlb.h
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-01-27 12:12 ` [PATCH v4 2/8] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
` (7 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
From: Qi Zheng <zhengqi.arch@bytedance.com>
Generally, the asm/tlb.h will include asm-generic/tlb.h, so change
mm/pt_reclaim.c to use asm/tlb.h instead of asm-generic/tlb.h. This is a
preparation for enabling CONFIG_PT_RECLAIM on other architectures, such as
alpha.
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/pt_reclaim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c
index 0d9cfbf4fe5d8..46771cfff8239 100644
--- a/mm/pt_reclaim.c
+++ b/mm/pt_reclaim.c
@@ -2,7 +2,7 @@
#include <linux/hugetlb.h>
#include <linux/pgalloc.h>
-#include <asm-generic/tlb.h>
+#include <asm/tlb.h>
#include "internal.h"
--
2.20.1
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH v4 2/8] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
2026-01-27 12:12 ` [PATCH v4 1/8] mm: change mm/pt_reclaim.c to use asm/tlb.h instead of asm-generic/tlb.h Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-02-01 22:01 ` Magnus Lindholm
2026-01-27 12:12 ` [PATCH v4 3/8] LoongArch: " Qi Zheng
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, 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 | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 80367f2cf821c..6c7dbf0adad62 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -38,6 +38,7 @@ config ALPHA
select OLD_SIGSUSPEND
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
select MMU_GATHER_NO_RANGE
+ select MMU_GATHER_RCU_TABLE_FREE
select SPARSEMEM_EXTREME if SPARSEMEM
select ZONE_DMA
help
diff --git a/arch/alpha/include/asm/tlb.h b/arch/alpha/include/asm/tlb.h
index 4f79e331af5ea..ad586b898fd6b 100644
--- a/arch/alpha/include/asm/tlb.h
+++ b/arch/alpha/include/asm/tlb.h
@@ -4,7 +4,7 @@
#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 [flat|nested] 19+ messages in thread* Re: [PATCH v4 2/8] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 ` [PATCH v4 2/8] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
@ 2026-02-01 22:01 ` Magnus Lindholm
0 siblings, 0 replies; 19+ messages in thread
From: Magnus Lindholm @ 2026-02-01 22:01 UTC (permalink / raw)
To: Qi Zheng
Cc: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, akpm, linux-arch, linux-kernel,
linux-mm, linux-alpha, loongarch, linux-mips, linux-parisc,
linux-um, sparclinux, Qi Zheng, Richard Henderson, Matt Turner
On Tue, Jan 27, 2026 at 1:16 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: Richard Henderson <richard.henderson@linaro.org>
> Cc: Matt Turner <mattst88@gmail.com>
> ---
> arch/alpha/Kconfig | 1 +
> arch/alpha/include/asm/tlb.h | 6 +++---
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 80367f2cf821c..6c7dbf0adad62 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -38,6 +38,7 @@ config ALPHA
> select OLD_SIGSUSPEND
> select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
> select MMU_GATHER_NO_RANGE
> + select MMU_GATHER_RCU_TABLE_FREE
> select SPARSEMEM_EXTREME if SPARSEMEM
> select ZONE_DMA
> help
> diff --git a/arch/alpha/include/asm/tlb.h b/arch/alpha/include/asm/tlb.h
> index 4f79e331af5ea..ad586b898fd6b 100644
> --- a/arch/alpha/include/asm/tlb.h
> +++ b/arch/alpha/include/asm/tlb.h
> @@ -4,7 +4,7 @@
>
> #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
>
Looks good from an Alpha perspective.
Acked-by: Magnus Lindholm <linmag7@gmail.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 3/8] LoongArch: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
2026-01-27 12:12 ` [PATCH v4 1/8] mm: change mm/pt_reclaim.c to use asm/tlb.h instead of asm-generic/tlb.h Qi Zheng
2026-01-27 12:12 ` [PATCH v4 2/8] alpha: mm: enable MMU_GATHER_RCU_TABLE_FREE Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-01-27 12:12 ` [PATCH v4 4/8] mips: " Qi Zheng
` (5 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, 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 | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 730f342145197..43d5b863e1fb2 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -187,6 +187,7 @@ config LOONGARCH
select IRQ_LOONGARCH_CPU
select LOCK_MM_AND_FIND_VMA
select MMU_GATHER_MERGE_VMAS if MMU
+ select MMU_GATHER_RCU_TABLE_FREE
select MODULES_USE_ELF_RELA if MODULES
select NEED_PER_CPU_EMBED_FIRST_CHUNK
select NEED_PER_CPU_PAGE_FIRST_CHUNK
diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h
index 08dcc698ec184..248f62d0b590e 100644
--- a/arch/loongarch/include/asm/pgalloc.h
+++ b/arch/loongarch/include/asm/pgalloc.h
@@ -55,8 +55,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
return pte;
}
-#define __pte_free_tlb(tlb, pte, address) \
- tlb_remove_ptdesc((tlb), page_ptdesc(pte))
+#define __pte_free_tlb(tlb, pte, address) tlb_remove_ptdesc((tlb), page_ptdesc(pte))
#ifndef __PAGETABLE_PMD_FOLDED
@@ -79,7 +78,7 @@ 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 +98,7 @@ 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 [flat|nested] 19+ messages in thread* [PATCH v4 4/8] mips: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (2 preceding siblings ...)
2026-01-27 12:12 ` [PATCH v4 3/8] LoongArch: " Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-01-27 12:12 ` [PATCH v4 5/8] parisc: " Qi Zheng
` (4 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, 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 | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b88b97139fa8e..c0c94e26ce396 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -99,6 +99,7 @@ config MIPS
select IRQ_FORCED_THREADING
select ISA if EISA
select LOCK_MM_AND_FIND_VMA
+ select MMU_GATHER_RCU_TABLE_FREE
select MODULES_USE_ELF_REL if MODULES
select MODULES_USE_ELF_RELA if MODULES && 64BIT
select PERF_USE_VMALLOC
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index 7a04381efa0b5..895bf79e76762 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -48,8 +48,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
extern void pgd_init(void *addr);
extern pgd_t *pgd_alloc(struct mm_struct *mm);
-#define __pte_free_tlb(tlb, pte, address) \
- tlb_remove_ptdesc((tlb), page_ptdesc(pte))
+#define __pte_free_tlb(tlb, pte, address) tlb_remove_ptdesc((tlb), page_ptdesc(pte))
#ifndef __PAGETABLE_PMD_FOLDED
@@ -72,7 +71,7 @@ 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
@@ -97,7 +96,7 @@ 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 [flat|nested] 19+ messages in thread* [PATCH v4 5/8] parisc: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (3 preceding siblings ...)
2026-01-27 12:12 ` [PATCH v4 4/8] mips: " Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-02-07 2:34 ` Helge Deller
2026-01-27 12:12 ` [PATCH v4 6/8] um: " Qi Zheng
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, 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 | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47fd9662d8005..62d5a89d5c7bc 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -79,6 +79,7 @@ config PARISC
select GENERIC_CLOCKEVENTS
select CPU_NO_EFFICIENT_FFS
select THREAD_INFO_IN_TASK
+ select MMU_GATHER_RCU_TABLE_FREE
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
select HAVE_ARCH_KGDB
diff --git a/arch/parisc/include/asm/tlb.h b/arch/parisc/include/asm/tlb.h
index 44235f367674d..4501fee0a8fa4 100644
--- a/arch/parisc/include/asm/tlb.h
+++ b/arch/parisc/include/asm/tlb.h
@@ -5,8 +5,8 @@
#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 [flat|nested] 19+ messages in thread* Re: [PATCH v4 5/8] parisc: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 ` [PATCH v4 5/8] parisc: " Qi Zheng
@ 2026-02-07 2:34 ` Helge Deller
0 siblings, 0 replies; 19+ messages in thread
From: Helge Deller @ 2026-02-07 2:34 UTC (permalink / raw)
To: Qi Zheng; +Cc: linux-arch, linux-kernel, linux-mm, linux-parisc, Qi Zheng
On 1/27/26 13:12, 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: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: Helge Deller <deller@gmx.de>
> ---
> arch/parisc/Kconfig | 1 +
> arch/parisc/include/asm/tlb.h | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
Acked-by: Helge Deller <deller@gmx.de> # parisc
Tested-by: Helge Deller <deller@gmx.de> # parisc
Thanks!
Helge
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 6/8] um: mm: enable MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (4 preceding siblings ...)
2026-01-27 12:12 ` [PATCH v4 5/8] parisc: " Qi Zheng
@ 2026-01-27 12:12 ` Qi Zheng
2026-01-27 12:13 ` [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config Qi Zheng
` (2 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:12 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, 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 8415d39b0d430..098cda44db225 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -42,6 +42,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 [flat|nested] 19+ messages in thread* [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (5 preceding siblings ...)
2026-01-27 12:12 ` [PATCH v4 6/8] um: " Qi Zheng
@ 2026-01-27 12:13 ` Qi Zheng
2026-02-06 11:06 ` David Hildenbrand (Arm)
2026-01-27 12:13 ` [PATCH v4 8/8] mm: make PT_RECLAIM depends on MMU_GATHER_RCU_TABLE_FREE Qi Zheng
2026-01-27 20:46 ` [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Andrew Morton
8 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:13 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
From: Qi Zheng <zhengqi.arch@bytedance.com>
For architectures that define __HAVE_ARCH_TLB_REMOVE_TABLE, the page
tables at the pmd/pud level are generally not of struct ptdesc type, and
do not have pt_rcu_head member, thus these architectures cannot support
PT_RECLAIM.
In preparation for enabling PT_RECLAIM on more architectures, convert
__HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config,
so that we can make conditional judgments in Kconfig.
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/tlb.h | 1 -
arch/sparc/Kconfig | 1 +
arch/sparc/include/asm/tlb_64.h | 1 -
include/asm-generic/tlb.h | 2 +-
mm/Kconfig | 3 +++
6 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9537a61ebae02..b47aa8fd62742 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -304,6 +304,7 @@ config PPC
select LOCK_MM_AND_FIND_VMA
select MMU_GATHER_PAGE_SIZE
select MMU_GATHER_RCU_TABLE_FREE
+ select HAVE_ARCH_TLB_REMOVE_TABLE
select MMU_GATHER_MERGE_VMAS
select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
select MODULES_USE_ELF_RELA
diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
index 2058e8d3e0138..1ca7d4c4b90db 100644
--- a/arch/powerpc/include/asm/tlb.h
+++ b/arch/powerpc/include/asm/tlb.h
@@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
*/
#define tlb_needs_table_invalidate() radix_enabled()
-#define __HAVE_ARCH_TLB_REMOVE_TABLE
/* Get the generic bits... */
#include <asm-generic/tlb.h>
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index a630d373e6453..25fa2908d6152 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -74,6 +74,7 @@ config SPARC64
select HAVE_KRETPROBES
select HAVE_KPROBES
select MMU_GATHER_RCU_TABLE_FREE if SMP
+ select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
select MMU_GATHER_MERGE_VMAS
select MMU_GATHER_NO_FLUSH_CACHE
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h
index 1a6e694418e39..3037187482db7 100644
--- a/arch/sparc/include/asm/tlb_64.h
+++ b/arch/sparc/include/asm/tlb_64.h
@@ -33,7 +33,6 @@ void flush_tlb_pending(void);
#define tlb_needs_table_invalidate() (false)
#endif
-#define __HAVE_ARCH_TLB_REMOVE_TABLE
#include <asm-generic/tlb.h>
#endif /* _SPARC64_TLB_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 4d679d2a206b4..3427b8036ba33 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -213,7 +213,7 @@ struct mmu_table_batch {
#define MAX_TABLE_BATCH \
((PAGE_SIZE - sizeof(struct mmu_table_batch)) / sizeof(void *))
-#ifndef __HAVE_ARCH_TLB_REMOVE_TABLE
+#ifndef CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
static inline void __tlb_remove_table(void *table)
{
struct ptdesc *ptdesc = (struct ptdesc *)table;
diff --git a/mm/Kconfig b/mm/Kconfig
index a992f2203eb91..456e9eaedca39 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1451,6 +1451,9 @@ 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 HAVE_ARCH_TLB_REMOVE_TABLE
+ def_bool n
+
config ARCH_SUPPORTS_PT_RECLAIM
def_bool n
--
2.20.1
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-01-27 12:13 ` [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config Qi Zheng
@ 2026-02-06 11:06 ` David Hildenbrand (Arm)
2026-02-06 11:13 ` Qi Zheng
0 siblings, 1 reply; 19+ messages in thread
From: David Hildenbrand (Arm) @ 2026-02-06 11:06 UTC (permalink / raw)
To: Qi Zheng, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 1/27/26 13:13, Qi Zheng wrote:
> From: Qi Zheng <zhengqi.arch@bytedance.com>
>
> For architectures that define __HAVE_ARCH_TLB_REMOVE_TABLE, the page
> tables at the pmd/pud level are generally not of struct ptdesc type, and
> do not have pt_rcu_head member, thus these architectures cannot support
> PT_RECLAIM.
>
> In preparation for enabling PT_RECLAIM on more architectures, convert
> __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config,
> so that we can make conditional judgments in Kconfig.
>
> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/tlb.h | 1 -
> arch/sparc/Kconfig | 1 +
> arch/sparc/include/asm/tlb_64.h | 1 -
> include/asm-generic/tlb.h | 2 +-
> mm/Kconfig | 3 +++
> 6 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 9537a61ebae02..b47aa8fd62742 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -304,6 +304,7 @@ config PPC
> select LOCK_MM_AND_FIND_VMA
> select MMU_GATHER_PAGE_SIZE
> select MMU_GATHER_RCU_TABLE_FREE
> + select HAVE_ARCH_TLB_REMOVE_TABLE
> select MMU_GATHER_MERGE_VMAS
> select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
> select MODULES_USE_ELF_RELA
> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
> index 2058e8d3e0138..1ca7d4c4b90db 100644
> --- a/arch/powerpc/include/asm/tlb.h
> +++ b/arch/powerpc/include/asm/tlb.h
> @@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
> */
> #define tlb_needs_table_invalidate() radix_enabled()
>
> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
> /* Get the generic bits... */
> #include <asm-generic/tlb.h>
>
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index a630d373e6453..25fa2908d6152 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -74,6 +74,7 @@ config SPARC64
> select HAVE_KRETPROBES
> select HAVE_KPROBES
> select MMU_GATHER_RCU_TABLE_FREE if SMP
> + select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
Why the SMP? At least in tlb_64.h, it was not protected by SMP IIUC.
Apart from that LGTM.
--
Cheers,
David
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-02-06 11:06 ` David Hildenbrand (Arm)
@ 2026-02-06 11:13 ` Qi Zheng
2026-02-06 11:45 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2026-02-06 11:13 UTC (permalink / raw)
To: David Hildenbrand (Arm),
andreas, richard.weiyang, will, peterz, aneesh.kumar, npiggin,
dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 2/6/26 7:06 PM, David Hildenbrand (Arm) wrote:
> On 1/27/26 13:13, Qi Zheng wrote:
>> From: Qi Zheng <zhengqi.arch@bytedance.com>
>>
>> For architectures that define __HAVE_ARCH_TLB_REMOVE_TABLE, the page
>> tables at the pmd/pud level are generally not of struct ptdesc type, and
>> do not have pt_rcu_head member, thus these architectures cannot support
>> PT_RECLAIM.
>>
>> In preparation for enabling PT_RECLAIM on more architectures, convert
>> __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config,
>> so that we can make conditional judgments in Kconfig.
>>
>> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
>> ---
>> arch/powerpc/Kconfig | 1 +
>> arch/powerpc/include/asm/tlb.h | 1 -
>> arch/sparc/Kconfig | 1 +
>> arch/sparc/include/asm/tlb_64.h | 1 -
>> include/asm-generic/tlb.h | 2 +-
>> mm/Kconfig | 3 +++
>> 6 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index 9537a61ebae02..b47aa8fd62742 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -304,6 +304,7 @@ config PPC
>> select LOCK_MM_AND_FIND_VMA
>> select MMU_GATHER_PAGE_SIZE
>> select MMU_GATHER_RCU_TABLE_FREE
>> + select HAVE_ARCH_TLB_REMOVE_TABLE
>> select MMU_GATHER_MERGE_VMAS
>> select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
>> select MODULES_USE_ELF_RELA
>> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/
>> asm/tlb.h
>> index 2058e8d3e0138..1ca7d4c4b90db 100644
>> --- a/arch/powerpc/include/asm/tlb.h
>> +++ b/arch/powerpc/include/asm/tlb.h
>> @@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
>> */
>> #define tlb_needs_table_invalidate() radix_enabled()
>> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
>> /* Get the generic bits... */
>> #include <asm-generic/tlb.h>
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index a630d373e6453..25fa2908d6152 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -74,6 +74,7 @@ config SPARC64
>> select HAVE_KRETPROBES
>> select HAVE_KPROBES
>> select MMU_GATHER_RCU_TABLE_FREE if SMP
>> + select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
>
> Why the SMP? At least in tlb_64.h, it was not protected by SMP IIUC.
Ah, It's just simply aligned with the MMU_GATHER_RCU_TABLE_FREE above.
>
> Apart from that LGTM.
Thanks!
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-02-06 11:13 ` Qi Zheng
@ 2026-02-06 11:45 ` David Hildenbrand (Arm)
2026-02-06 11:58 ` Qi Zheng
0 siblings, 1 reply; 19+ messages in thread
From: David Hildenbrand (Arm) @ 2026-02-06 11:45 UTC (permalink / raw)
To: Qi Zheng, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 2/6/26 12:13, Qi Zheng wrote:
>
>
> On 2/6/26 7:06 PM, David Hildenbrand (Arm) wrote:
>> On 1/27/26 13:13, Qi Zheng wrote:
>>> From: Qi Zheng <zhengqi.arch@bytedance.com>
>>>
>>> For architectures that define __HAVE_ARCH_TLB_REMOVE_TABLE, the page
>>> tables at the pmd/pud level are generally not of struct ptdesc type, and
>>> do not have pt_rcu_head member, thus these architectures cannot support
>>> PT_RECLAIM.
>>>
>>> In preparation for enabling PT_RECLAIM on more architectures, convert
>>> __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
>>> config,
>>> so that we can make conditional judgments in Kconfig.
>>>
>>> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
>>> ---
>>> arch/powerpc/Kconfig | 1 +
>>> arch/powerpc/include/asm/tlb.h | 1 -
>>> arch/sparc/Kconfig | 1 +
>>> arch/sparc/include/asm/tlb_64.h | 1 -
>>> include/asm-generic/tlb.h | 2 +-
>>> mm/Kconfig | 3 +++
>>> 6 files changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index 9537a61ebae02..b47aa8fd62742 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -304,6 +304,7 @@ config PPC
>>> select LOCK_MM_AND_FIND_VMA
>>> select MMU_GATHER_PAGE_SIZE
>>> select MMU_GATHER_RCU_TABLE_FREE
>>> + select HAVE_ARCH_TLB_REMOVE_TABLE
>>> select MMU_GATHER_MERGE_VMAS
>>> select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
>>> select MODULES_USE_ELF_RELA
>>> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/
>>> asm/tlb.h
>>> index 2058e8d3e0138..1ca7d4c4b90db 100644
>>> --- a/arch/powerpc/include/asm/tlb.h
>>> +++ b/arch/powerpc/include/asm/tlb.h
>>> @@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
>>> */
>>> #define tlb_needs_table_invalidate() radix_enabled()
>>> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
>>> /* Get the generic bits... */
>>> #include <asm-generic/tlb.h>
>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>> index a630d373e6453..25fa2908d6152 100644
>>> --- a/arch/sparc/Kconfig
>>> +++ b/arch/sparc/Kconfig
>>> @@ -74,6 +74,7 @@ config SPARC64
>>> select HAVE_KRETPROBES
>>> select HAVE_KPROBES
>>> select MMU_GATHER_RCU_TABLE_FREE if SMP
>>> + select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
>>
>> Why the SMP? At least in tlb_64.h, it was not protected by SMP IIUC.
>
> Ah, It's just simply aligned with the MMU_GATHER_RCU_TABLE_FREE above.
But does that work as expected for !SMP?
--
Cheers,
David
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-02-06 11:45 ` David Hildenbrand (Arm)
@ 2026-02-06 11:58 ` Qi Zheng
2026-02-06 12:59 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 19+ messages in thread
From: Qi Zheng @ 2026-02-06 11:58 UTC (permalink / raw)
To: David Hildenbrand (Arm),
andreas, richard.weiyang, will, peterz, aneesh.kumar, npiggin,
dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 2/6/26 7:45 PM, David Hildenbrand (Arm) wrote:
> On 2/6/26 12:13, Qi Zheng wrote:
>>
>>
>> On 2/6/26 7:06 PM, David Hildenbrand (Arm) wrote:
>>> On 1/27/26 13:13, Qi Zheng wrote:
>>>> From: Qi Zheng <zhengqi.arch@bytedance.com>
>>>>
>>>> For architectures that define __HAVE_ARCH_TLB_REMOVE_TABLE, the page
>>>> tables at the pmd/pud level are generally not of struct ptdesc type,
>>>> and
>>>> do not have pt_rcu_head member, thus these architectures cannot support
>>>> PT_RECLAIM.
>>>>
>>>> In preparation for enabling PT_RECLAIM on more architectures, convert
>>>> __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
>>>> config,
>>>> so that we can make conditional judgments in Kconfig.
>>>>
>>>> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
>>>> ---
>>>> arch/powerpc/Kconfig | 1 +
>>>> arch/powerpc/include/asm/tlb.h | 1 -
>>>> arch/sparc/Kconfig | 1 +
>>>> arch/sparc/include/asm/tlb_64.h | 1 -
>>>> include/asm-generic/tlb.h | 2 +-
>>>> mm/Kconfig | 3 +++
>>>> 6 files changed, 6 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>>> index 9537a61ebae02..b47aa8fd62742 100644
>>>> --- a/arch/powerpc/Kconfig
>>>> +++ b/arch/powerpc/Kconfig
>>>> @@ -304,6 +304,7 @@ config PPC
>>>> select LOCK_MM_AND_FIND_VMA
>>>> select MMU_GATHER_PAGE_SIZE
>>>> select MMU_GATHER_RCU_TABLE_FREE
>>>> + select HAVE_ARCH_TLB_REMOVE_TABLE
>>>> select MMU_GATHER_MERGE_VMAS
>>>> select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
>>>> select MODULES_USE_ELF_RELA
>>>> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/
>>>> asm/tlb.h
>>>> index 2058e8d3e0138..1ca7d4c4b90db 100644
>>>> --- a/arch/powerpc/include/asm/tlb.h
>>>> +++ b/arch/powerpc/include/asm/tlb.h
>>>> @@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather *tlb);
>>>> */
>>>> #define tlb_needs_table_invalidate() radix_enabled()
>>>> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
>>>> /* Get the generic bits... */
>>>> #include <asm-generic/tlb.h>
>>>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>>>> index a630d373e6453..25fa2908d6152 100644
>>>> --- a/arch/sparc/Kconfig
>>>> +++ b/arch/sparc/Kconfig
>>>> @@ -74,6 +74,7 @@ config SPARC64
>>>> select HAVE_KRETPROBES
>>>> select HAVE_KPROBES
>>>> select MMU_GATHER_RCU_TABLE_FREE if SMP
>>>> + select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
>>>
>>> Why the SMP? At least in tlb_64.h, it was not protected by SMP IIUC.
>>
>> Ah, It's just simply aligned with the MMU_GATHER_RCU_TABLE_FREE above.
>
> But does that work as expected for !SMP?
In the case of !SMP, tlb_remove_table() will not be called:
static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table,
bool is_page)
{
pgtable_free(table, is_page);
}
so I think it's okay to only select it in case of SMP.
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-02-06 11:58 ` Qi Zheng
@ 2026-02-06 12:59 ` David Hildenbrand (Arm)
2026-02-06 13:33 ` Andreas Larsson
0 siblings, 1 reply; 19+ messages in thread
From: David Hildenbrand (Arm) @ 2026-02-06 12:59 UTC (permalink / raw)
To: Qi Zheng, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 2/6/26 12:58, Qi Zheng wrote:
>
>
> On 2/6/26 7:45 PM, David Hildenbrand (Arm) wrote:
>> On 2/6/26 12:13, Qi Zheng wrote:
>>>
>>>
>>>
>>> Ah, It's just simply aligned with the MMU_GATHER_RCU_TABLE_FREE above.
>>
>> But does that work as expected for !SMP?
>
> In the case of !SMP, tlb_remove_table() will not be called:
>
> static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table,
> bool is_page)
> {
> pgtable_free(table, is_page);
> }
Ah, okay. Confusing stuff. Would have been nice to document/mention that
in the patch description.
So if it compiles, all good
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
2026-02-06 12:59 ` David Hildenbrand (Arm)
@ 2026-02-06 13:33 ` Andreas Larsson
0 siblings, 0 replies; 19+ messages in thread
From: Andreas Larsson @ 2026-02-06 13:33 UTC (permalink / raw)
To: David Hildenbrand (Arm),
Qi Zheng, richard.weiyang, will, peterz, aneesh.kumar, npiggin,
dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
On 2026-02-06 13:59, David Hildenbrand (Arm) wrote:
> On 2/6/26 12:58, Qi Zheng wrote:
>>
>>
>> On 2/6/26 7:45 PM, David Hildenbrand (Arm) wrote:
>>> On 2/6/26 12:13, Qi Zheng wrote:
>>>>
>>>>
>>>>
>>>> Ah, It's just simply aligned with the MMU_GATHER_RCU_TABLE_FREE above.
>>>
>>> But does that work as expected for !SMP?
>>
>> In the case of !SMP, tlb_remove_table() will not be called:
>>
>> static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)
>> {
>> pgtable_free(table, is_page);
>> }
>
> Ah, okay. Confusing stuff. Would have been nice to document/mention that in the patch description.
>
> So if it compiles, all good
>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
>
It looks a bit weird, but it is actually more logically correct than
before the patch. Before this in the !SMP sparc64 case
__HAVE_ARCH_TLB_REMOVE_TABLE was defined even with no actual
__tlb_remove_table() present. But it did not matter in practice.
But I agree that a mention would not hurt.
Tested both with SMP and !SMP
Tested-by: Andreas Larsson <andreas@gaisler.com> #sparc
Acked-by: Andreas Larsson <andreas@gaisler.com> #sparc
Cheers,
Andreas
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 8/8] mm: make PT_RECLAIM depends on MMU_GATHER_RCU_TABLE_FREE
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (6 preceding siblings ...)
2026-01-27 12:13 ` [PATCH v4 7/8] mm: convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config Qi Zheng
@ 2026-01-27 12:13 ` Qi Zheng
2026-01-27 20:46 ` [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Andrew Morton
8 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-27 12:13 UTC (permalink / raw)
To: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, akpm
Cc: linux-arch, linux-kernel, linux-mm, linux-alpha, loongarch,
linux-mips, linux-parisc, linux-um, sparclinux, Qi Zheng
From: Qi Zheng <zhengqi.arch@bytedance.com>
The PT_RECLAIM can work on all architectures that support
MMU_GATHER_RCU_TABLE_FREE, except for those that have selected
HAVE_ARCH_TLB_REMOVE_TABLE,so make PT_RECLAIM depends on
MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE.
BTW, change PT_RECLAIM to be enabled by default, since nobody should want
to turn it off.
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
arch/x86/Kconfig | 1 -
mm/Kconfig | 9 ++-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 80527299f859a..0d22da56a71b0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -331,7 +331,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 456e9eaedca39..1f3109b164d86 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1454,14 +1454,9 @@ config ARCH_HAS_USER_SHADOW_STACK
config HAVE_ARCH_TLB_REMOVE_TABLE
def_bool n
-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
+ def_bool y
+ depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
help
Try to reclaim empty user page table pages in paths other than munmap
and exit_mmap path.
--
2.20.1
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures
2026-01-27 12:12 [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Qi Zheng
` (7 preceding siblings ...)
2026-01-27 12:13 ` [PATCH v4 8/8] mm: make PT_RECLAIM depends on MMU_GATHER_RCU_TABLE_FREE Qi Zheng
@ 2026-01-27 20:46 ` Andrew Morton
2026-01-28 2:07 ` Qi Zheng
8 siblings, 1 reply; 19+ messages in thread
From: Andrew Morton @ 2026-01-27 20:46 UTC (permalink / raw)
To: Qi Zheng
Cc: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, linux-arch, linux-kernel,
linux-mm, linux-alpha, loongarch, linux-mips, linux-parisc,
linux-um, sparclinux, Qi Zheng
On Tue, 27 Jan 2026 20:12:53 +0800 Qi Zheng <qi.zheng@linux.dev> wrote:
> This series aims to enable PT_RECLAIM on more 64-bit architectures.
Thanks, I updated mm.git's mm-unstable branch to v4.
> Changes in v4:
> - convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
> - fix a WARN_ON_ONCE() on sparc64 (and on ppc)
> (reported by Andreas Larsson)
> - collect Acked-by (Hi David, I've kept your Acked-by, feel free to drop it)
> - rebase onto the v6.19-rc7
>
Below is how v4 altered mm.git.
I'm not seeing the WARN_ON_ONCE() fix. I assume that was due to the
Kconfig alterations?
--- a/arch/powerpc/include/asm/tlb.h~b
+++ a/arch/powerpc/include/asm/tlb.h
@@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather
*/
#define tlb_needs_table_invalidate() radix_enabled()
-#define __HAVE_ARCH_TLB_REMOVE_TABLE
/* Get the generic bits... */
#include <asm-generic/tlb.h>
--- a/arch/powerpc/Kconfig~b
+++ a/arch/powerpc/Kconfig
@@ -305,6 +305,7 @@ config PPC
select LOCK_MM_AND_FIND_VMA
select MMU_GATHER_PAGE_SIZE
select MMU_GATHER_RCU_TABLE_FREE
+ select HAVE_ARCH_TLB_REMOVE_TABLE
select MMU_GATHER_MERGE_VMAS
select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
select MODULES_USE_ELF_RELA
--- a/arch/sparc/include/asm/tlb_64.h~b
+++ a/arch/sparc/include/asm/tlb_64.h
@@ -33,7 +33,6 @@ void flush_tlb_pending(void);
#define tlb_needs_table_invalidate() (false)
#endif
-#define __HAVE_ARCH_TLB_REMOVE_TABLE
#include <asm-generic/tlb.h>
#endif /* _SPARC64_TLB_H */
--- a/arch/sparc/Kconfig~b
+++ a/arch/sparc/Kconfig
@@ -74,6 +74,7 @@ config SPARC64
select HAVE_KRETPROBES
select HAVE_KPROBES
select MMU_GATHER_RCU_TABLE_FREE if SMP
+ select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
select MMU_GATHER_MERGE_VMAS
select MMU_GATHER_NO_FLUSH_CACHE
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
--- a/include/asm-generic/tlb.h~b
+++ a/include/asm-generic/tlb.h
@@ -213,7 +213,7 @@ struct mmu_table_batch {
#define MAX_TABLE_BATCH \
((PAGE_SIZE - sizeof(struct mmu_table_batch)) / sizeof(void *))
-#ifndef __HAVE_ARCH_TLB_REMOVE_TABLE
+#ifndef CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
static inline void __tlb_remove_table(void *table)
{
struct ptdesc *ptdesc = (struct ptdesc *)table;
--- a/mm/Kconfig~b
+++ a/mm/Kconfig
@@ -1448,9 +1448,12 @@ 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 HAVE_ARCH_TLB_REMOVE_TABLE
+ def_bool n
+
config PT_RECLAIM
def_bool y
- depends on MMU_GATHER_RCU_TABLE_FREE
+ depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
help
Try to reclaim empty user page table pages in paths other than munmap
and exit_mmap path.
_
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures
2026-01-27 20:46 ` [PATCH v4 0/8] enable PT_RECLAIM on more 64-bit architectures Andrew Morton
@ 2026-01-28 2:07 ` Qi Zheng
0 siblings, 0 replies; 19+ messages in thread
From: Qi Zheng @ 2026-01-28 2:07 UTC (permalink / raw)
To: Andrew Morton
Cc: david, andreas, richard.weiyang, will, peterz, aneesh.kumar,
npiggin, dev.jain, ioworker0, linmag7, linux-arch, linux-kernel,
linux-mm, linux-alpha, loongarch, linux-mips, linux-parisc,
linux-um, sparclinux, Qi Zheng
On 1/28/26 4:46 AM, Andrew Morton wrote:
> On Tue, 27 Jan 2026 20:12:53 +0800 Qi Zheng <qi.zheng@linux.dev> wrote:
>
>> This series aims to enable PT_RECLAIM on more 64-bit architectures.
>
> Thanks, I updated mm.git's mm-unstable branch to v4.
>
>> Changes in v4:
>> - convert __HAVE_ARCH_TLB_REMOVE_TABLE to CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE config
>> - fix a WARN_ON_ONCE() on sparc64 (and on ppc)
>> (reported by Andreas Larsson)
>> - collect Acked-by (Hi David, I've kept your Acked-by, feel free to drop it)
>> - rebase onto the v6.19-rc7
>>
>
> Below is how v4 altered mm.git.
>
> I'm not seeing the WARN_ON_ONCE() fix. I assume that was due to the
> Kconfig alterations?
Yes, sparc64 and ppc will select HAVE_ARCH_TLB_REMOVE_TABLE, so
PT_RECLAIM will not be enabled. This means it won't affect
sparc64 and ppc, and will not trigger WARN_ON_ONCE().
I don't have a testing environment for sparc64 and ppc, but I
expect it should be able to fix the WARN_ON_ONCE().
Thanks,
Qi
>
>
>
> --- a/arch/powerpc/include/asm/tlb.h~b
> +++ a/arch/powerpc/include/asm/tlb.h
> @@ -37,7 +37,6 @@ extern void tlb_flush(struct mmu_gather
> */
> #define tlb_needs_table_invalidate() radix_enabled()
>
> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
> /* Get the generic bits... */
> #include <asm-generic/tlb.h>
>
> --- a/arch/powerpc/Kconfig~b
> +++ a/arch/powerpc/Kconfig
> @@ -305,6 +305,7 @@ config PPC
> select LOCK_MM_AND_FIND_VMA
> select MMU_GATHER_PAGE_SIZE
> select MMU_GATHER_RCU_TABLE_FREE
> + select HAVE_ARCH_TLB_REMOVE_TABLE
> select MMU_GATHER_MERGE_VMAS
> select MMU_LAZY_TLB_SHOOTDOWN if PPC_BOOK3S_64
> select MODULES_USE_ELF_RELA
> --- a/arch/sparc/include/asm/tlb_64.h~b
> +++ a/arch/sparc/include/asm/tlb_64.h
> @@ -33,7 +33,6 @@ void flush_tlb_pending(void);
> #define tlb_needs_table_invalidate() (false)
> #endif
>
> -#define __HAVE_ARCH_TLB_REMOVE_TABLE
> #include <asm-generic/tlb.h>
>
> #endif /* _SPARC64_TLB_H */
> --- a/arch/sparc/Kconfig~b
> +++ a/arch/sparc/Kconfig
> @@ -74,6 +74,7 @@ config SPARC64
> select HAVE_KRETPROBES
> select HAVE_KPROBES
> select MMU_GATHER_RCU_TABLE_FREE if SMP
> + select HAVE_ARCH_TLB_REMOVE_TABLE if SMP
> select MMU_GATHER_MERGE_VMAS
> select MMU_GATHER_NO_FLUSH_CACHE
> select HAVE_ARCH_TRANSPARENT_HUGEPAGE
> --- a/include/asm-generic/tlb.h~b
> +++ a/include/asm-generic/tlb.h
> @@ -213,7 +213,7 @@ struct mmu_table_batch {
> #define MAX_TABLE_BATCH \
> ((PAGE_SIZE - sizeof(struct mmu_table_batch)) / sizeof(void *))
>
> -#ifndef __HAVE_ARCH_TLB_REMOVE_TABLE
> +#ifndef CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
> static inline void __tlb_remove_table(void *table)
> {
> struct ptdesc *ptdesc = (struct ptdesc *)table;
> --- a/mm/Kconfig~b
> +++ a/mm/Kconfig
> @@ -1448,9 +1448,12 @@ 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 HAVE_ARCH_TLB_REMOVE_TABLE
> + def_bool n
> +
> config PT_RECLAIM
> def_bool y
> - depends on MMU_GATHER_RCU_TABLE_FREE
> + depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
> help
> Try to reclaim empty user page table pages in paths other than munmap
> and exit_mmap path.
> _
>
^ permalink raw reply [flat|nested] 19+ messages in thread