Re: [PATCH 2/7] arc: mm: enable MMU_GATHER_RCU_TABLE_FREE

Qi Zheng
2025-11-14T11:20:44Z

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 */