From nobody Mon Feb 9 01:42:58 2026 Received: from out28-97.mail.aliyun.com (out28-97.mail.aliyun.com [115.124.28.97]) (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 10B3437F8AF for ; Wed, 14 Jan 2026 13:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.97 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768397886; cv=none; b=tIWQGu6ynP6YDPHRnVpZW94MfyPXFlIOuAqYay0wj+4uqysbZGx86Q83hWmRT2iljF0M9QgdaJd90d64TCx4Hh08fhy//6EeXalgTYsa+ikpst2r+kE28mPt8y64WV2xzkph9EotA0vJWkOZjXD5OFtq7nUvW3K81PQu+ZQK4t8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768397886; c=relaxed/simple; bh=GiWx7LyRClwFolTZOKyV9CtU0eLWVITnLX+V8G6iGes=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=W+MwjJ8tgJf4OwfUCk8e2mS2q/+2laHiWXsb8pmX9LisaHpUlsnhaxXPA+AgYFIuNvfH/Qk2QBYsgXiKFk2gVc215kLxe6pTpGHLkO2vYCluc9eWIdr0YpQI5k5V5saCeuMJ6Zng59hExTjrXHRnCxKAyz4C26MvVdmZwfZ3W+s= 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=fr2K2jBY; arc=none smtp.client-ip=115.124.28.97 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="fr2K2jBY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1768397876; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=zo5QFzHxrKH3yKj2e8kAMfytZW6A3kLuv3m6sA60HCI=; b=fr2K2jBYhxKHW56szkAijT5fLSyhrSyv1oqVTbO6n6U32rnnBTgj0B3NVt6e4wTVysKEJUcO2sNICWL17TxiMPHZuFkqJhe1VGiJpPqfKlTkvURvHvfpZDGsejhLfQc4zmb635Wuu6LRXTEpPotRj7CNAiK399D1AGRnETYuVwQ= Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.g6MGbUd_1768396935 cluster:ay29) by smtp.aliyun-inc.com; Wed, 14 Jan 2026 21:22:16 +0800 From: Hou Wenlong To: linux-kernel@vger.kernel.org Cc: Hou Wenlong , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Rik van Riel , Andrew Morton , Will Deacon , Ryan Roberts , Jann Horn , Barry Song Subject: [PATCH] x86/mm: Hide mm_free_global_asid() definition under 'CONFIG_BROADCAST_TLB_FLUSH' Date: Wed, 14 Jan 2026 21:21:54 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 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. Signed-off-by: Hou Wenlong Reviewed-by: Rik van Riel --- arch/x86/include/asm/mmu_context.h | 5 ----- arch/x86/include/asm/tlbflush.h | 3 +++ arch/x86/mm/tlb.c | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_= context.h index 73bf3b1b44e8..fa99293dcd91 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -139,11 +139,6 @@ static inline void mm_reset_untag_mask(struct mm_struc= t *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); - /* * Init a new mm. Used on mm copies, like at fork() * and on mm's that are brand-new, like at execve(). 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? --=20 2.31.1