From nobody Mon Feb 9 08:29:57 2026 Received: from out28-124.mail.aliyun.com (out28-124.mail.aliyun.com [115.124.28.124]) (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 37E8F274B48 for ; Thu, 15 Jan 2026 03:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768448349; cv=none; b=HTSVM6uMJmOhvYIByE5MTcXChObBaHHE/8LpKr3fXQo8a/DvUDxwymPGVE4/g959fdLzjvWxAXtHCkpBXd4K+3ZS/oqts+TLvr3lmHr26yn4D6MN9eG3gQcJ8URVt1azp9u8SPxNLgLL7FQ3keZWLK43j5y4SHY15vEtaG5dM1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768448349; c=relaxed/simple; bh=jaSMo1g4XDIvyiYXm6ER7ZMf8kW/QKL4jSW/uK63cSo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j03hhq8O5Y2A1ZJ8Tfh+eFh4NlIbjw/l5GEnC3dzubSTMOGztXsavvjajgc/Xdi8QWkRGzq9j9TgGhu3UqqUmF08r7vJ/xskRM5BTBErS36VZ4mGIIEuaZNezy979OA1ppwTIf+LYrEX3gsFZr2z9247kE+WBAmAyZrM1qTyEag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=qPMDKspJ; arc=none smtp.client-ip=115.124.28.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="qPMDKspJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1768448339; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=8BrnozK9+TPDGU0OtpoBvn4UPz0Ld0d5n3uuRXuGU7k=; b=qPMDKspJ6zzxW8087AntKPKPWClwiOHF2T8awC7xFlalFmPQt1Tafdvfkz0zRPju8Gh37mrEaGCsH1d/2LQsgnzsDf5G5SHGLXBy4ogOQarwcZFRrs2AGUoLZfKOG0RdkJD6wfIh0K5gApLqi8BooixZB4IiZ/gSLjGJ1Q2DOjM= Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.g6syFJt_1768448337 cluster:ay29) by smtp.aliyun-inc.com; Thu, 15 Jan 2026 11:38:57 +0800 From: Hou Wenlong To: linux-kernel@vger.kernel.org Cc: Hou Wenlong , Rik van Riel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Will Deacon , Ryan Roberts , Jann Horn , Barry Song Subject: [PATCH v2] x86/mm: Hide mm_free_global_asid() definition under 'CONFIG_BROADCAST_TLB_FLUSH' Date: Thu, 15 Jan 2026 11:38:34 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 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 Content-Type: text/plain; charset="utf-8" When 'CONFIG_BROADCAST_TLB_FLUSH' is not enabled, mm_free_global_asid() remains a globally visible symbol and generates a useless function call to it in destroy_context(). Therefore, hide the mm_free_global_asid() definition under 'CONFIG_BROADCAST_TLB_FLUSH' and provide a static inline empty version when it is not enabled to remove the function call. Reviewed-by: Rik van Riel Signed-off-by: Hou Wenlong --- v1->v2: Keep the declarations of mm_init_global_asid() and mm_free_global_asid() in 'asm/mmu_context.h' to fix the compilation failure of module building. --- arch/x86/include/asm/mmu_context.h | 2 -- arch/x86/include/asm/tlbflush.h | 3 +++ arch/x86/mm/tlb.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_= context.h index 73bf3b1b44e8..1acafb1c6a93 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -139,9 +139,7 @@ static inline void mm_reset_untag_mask(struct mm_struct= *mm) #define enter_lazy_tlb enter_lazy_tlb extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); =20 -#define mm_init_global_asid mm_init_global_asid extern void mm_init_global_asid(struct mm_struct *mm); - extern void mm_free_global_asid(struct mm_struct *mm); =20 /* diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflus= h.h index 00daedfefc1b..5114bf50c911 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -292,9 +292,12 @@ static inline bool mm_in_asid_transition(struct mm_str= uct *mm) =20 return mm && READ_ONCE(mm->context.asid_transition); } + +extern void mm_free_global_asid(struct mm_struct *mm); #else static inline u16 mm_global_asid(struct mm_struct *mm) { return 0; } static inline void mm_init_global_asid(struct mm_struct *mm) { } +static inline void mm_free_global_asid(struct mm_struct *mm) { } static inline void mm_assign_global_asid(struct mm_struct *mm, u16 asid) {= } static inline void mm_clear_asid_transition(struct mm_struct *mm) { } static inline bool mm_in_asid_transition(struct mm_struct *mm) { return fa= lse; } diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index f5b93e01e347..621e09d049cb 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -401,6 +401,7 @@ static void use_global_asid(struct mm_struct *mm) mm_assign_global_asid(mm, asid); } =20 +#ifdef CONFIG_BROADCAST_TLB_FLUSH void mm_free_global_asid(struct mm_struct *mm) { if (!cpu_feature_enabled(X86_FEATURE_INVLPGB)) @@ -412,13 +413,12 @@ void mm_free_global_asid(struct mm_struct *mm) guard(raw_spinlock_irqsave)(&global_asid_lock); =20 /* The global ASID can be re-used only after flush at wrap-around. */ -#ifdef CONFIG_BROADCAST_TLB_FLUSH __set_bit(mm->context.global_asid, global_asid_freed); =20 mm->context.global_asid =3D 0; global_asid_available++; -#endif } +#endif =20 /* * Is the mm transitioning from a CPU-local ASID to a global ASID? base-commit: 6e0e1737f35b9d3d071bba15dd36ae5ce3a5d292 --=20 2.31.1