From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-114.ptr.blmpb.com (va-1-114.ptr.blmpb.com [209.127.230.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF7973F23B9 for ; Tue, 9 Jun 2026 09:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.114 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996833; cv=none; b=UK+n5BMU/zB/yaNp6Xfgvs49gtd0GXwA+aBGmGBgzAiRYNGp5ORKNKD27twmCH/qVu5uOkFuIjtzI3lTZQba6QJMvpeUVoAtsEVkm/QyKMszehIAEK8OmwkXpOJkoGApVWaUSGaW0kRu/pBP/Qhg33S4EhigQzLzAujk2R5bN6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780996833; c=relaxed/simple; bh=CjO5IQ7eyxnBpKSOg5hd+k7+gXA3Gx6anGmd0jDMf+M=; h=Cc:Message-Id:To:From:Date:Content-Type:Subject:Mime-Version: In-Reply-To:References; b=q7RXX9+2Y6UKfIX6s1Tp1cGyGFWJaUdRF8rLGw9UnGLtd0FZx49/JViDNG33qvqUlLieIA2BJfuz+1DorZdFghgO55DOjGid+B1e7cbG7swYxUIC9uI1SSEyFqQemrScie6B60zRAby0kuk4tIea9xo5uv7PuCO9TqreZwMi7iA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=iIJuCq4i; arc=none smtp.client-ip=209.127.230.114 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="iIJuCq4i" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1780996827; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=o1BIbRwv+IHUIAwRnw+UqHCFRAeagRv5QIesHDgETH4=; b=iIJuCq4iHzylPYSnLuyOzqujI9/FX/MiqOrWlaCKhoQbTf7va0Lun1eKIum+yotqRxe89C SjT0aI4D+Hu0Y6RtndzDqsvXBEkPD7pG3nqid4gw3OkkFYyNaFz6d2AscglKDHVzFlmPK1 i0/MvoLixZbcr+oQo9i+adJfdx6woE+SRcvC6Yc6YMMvo8+T16h93b/JP0kdHVO1MyOkJ9 UiiXmBoQuh4VtPupooRijYTJ1FALZvpSV3hfewY1VrMHwj5n+azmhromozmoeiRibB/sxy wcZnOmh4mfCX18htyigmIwUDvtuVY/CvCKdyvX+hvWcuqhSIWQUMxbZAhkxlqw== X-Lms-Return-Path: Cc: , "Chuyi Zhou" Message-Id: <20260609091710.404083-12-zhouchuyi@bytedance.com> X-Original-From: Chuyi Zhou X-Mailer: git-send-email 2.20.1 To: , , , , , , , , , , , , , From: "Chuyi Zhou" Date: Tue, 9 Jun 2026 17:17:07 +0800 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Subject: [PATCH v7 11/14] x86/mm: Cap flush_tlb_info alignment at 64 bytes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <20260609091710.404083-1-zhouchuyi@bytedance.com> References: <20260609091710.404083-1-zhouchuyi@bytedance.com> A stack allocated flush_tlb_info should keep cacheline alignment to avoid the regression that motivated the per-CPU storage, but using SMP_CACHE_BYTES directly can make the stack frame grow excessively on configurations with large cache lines[1]. Add FLUSH_TLB_INFO_ALIGN and cap the type alignment at 64 bytes. The existing per-CPU flush_tlb_info instance remains DEFINE_PER_CPU_SHARED_ALIGNED(), so its per-CPU shared-cacheline alignment is unchanged. The capped type alignment matters once flush_tlb_info is moved back to the stack by the next patch. link[1]: https://lore.kernel.org/all/tip-780e0106d468a2962b16b52fdf42898f2639e0a0@git.kernel.org/ Signed-off-by: Chuyi Zhou --- arch/x86/include/asm/tlbflush.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 0545fe75c3fa..f4e4505d4ece 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -211,6 +211,12 @@ extern u16 invlpgb_count_max; extern void initialize_tlbstate_and_flush(void); +#if SMP_CACHE_BYTES > 64 +#define FLUSH_TLB_INFO_ALIGN 64 +#else +#define FLUSH_TLB_INFO_ALIGN SMP_CACHE_BYTES +#endif + /* * TLB flushing: * @@ -249,7 +255,7 @@ struct flush_tlb_info { u8 stride_shift; u8 freed_tables; u8 trim_cpumask; -}; +} __aligned(FLUSH_TLB_INFO_ALIGN); void flush_tlb_local(void); void flush_tlb_one_user(unsigned long addr); -- 2.20.1