From nobody Mon Feb 9 16:21:58 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9A2D314D28 for ; Fri, 14 Nov 2025 11:13:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763118833; cv=none; b=JrGadtVVl4XlHY9b/4qaScTKd0XlAWyreJ/r/3wSO+hV8MulKLH5lTivTvfEnyoWDrv2rtYNx2sTjPjLF9OTP1I8qySpZNLIw+UvsZ2WduONCJf5iCizIuz+limqiO2Up36EkGtLkyExzXT5rMRexKjSxz4MUTc1jPyf7Fy/uVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763118833; c=relaxed/simple; bh=K56VPDNxBdzrwtk5TC0vgJ3WcdonJxJasyGE9y6RtmA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ILaRJhCLgaQl7VZ7BkYacoA+JXqOtxC1/ycoSXDCjqIBUuhPw9um23XAYagvePbdgLB6mvH9n8OaGzF45QfgzY8uMUbOQ/tAJyR2Iq5HO6xDNgoz8po/75E+tcOzVXIwKEnT4xcczh/P24mdAndp6cvYQhl3gBLweI9CCbRwdpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Y9ji6TET; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Y9ji6TET" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763118828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2CgIQM8Rm+rrIBZ65Gc8uDgVfjAkTSjqf1Ed4GSiWMI=; b=Y9ji6TETXOEdJtN7riEZs1egBNIfxqbBF5em7JWsQrRQR5gaeRiytwZ+sxyYdN3yN2wb0q Cp2WEDEqOTCXmA8Q46TPNk2xSPagvU9B7BFxShiJtemzQIQxjnYV6Z0rYNSFwfadUPgSEc hGyB5DAs7t2eEqKZwitvuD99nlUBcqs= From: Qi Zheng To: will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, peterz@infradead.org, dev.jain@arm.com, akpm@linux-foundation.org, david@redhat.com, ioworker0@gmail.com Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-um@lists.infradead.org, Qi Zheng , Huacai Chen , WANG Xuerui Subject: [PATCH 3/7] loongarch: mm: enable MMU_GATHER_RCU_TABLE_FREE Date: Fri, 14 Nov 2025 19:11:17 +0800 Message-ID: <146b5a0207052b38d04caac6b20756a61c2189b3.1763117269.git.zhengqi.arch@bytedance.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Qi Zheng 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 Cc: Huacai Chen Cc: WANG Xuerui --- 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 =20 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; } =20 -#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)) =20 #endif =20 @@ -99,7 +100,8 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm,= unsigned long address) return pud; } =20 -#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)) =20 #endif /* __PAGETABLE_PUD_FOLDED */ =20 --=20 2.20.1