From patchwork Tue Dec 3 17:37:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 13892757 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 843501FC7DD; Tue, 3 Dec 2024 17:40:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733247655; cv=none; b=dQskJyZnje99JqUwv3+fVxmeSrugGkt0uMcY3YZr40d8zDl/OZ13sBAGFB9MOxyq1U559h5wSZRr5NqABRCqFiU+5ugyJDihzDSQhsrOzZImwX6X/alCQ36DJ5qNqCPyvFvEsQJdp+SWci2aGbWJnnGCoXaSEMup2vyW/tZiTS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733247655; c=relaxed/simple; bh=hCXkJobN9Y7lj3B9E3KE7PpBF8wrRPXTUlkmt82YSlU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=czkCeKtj84UAFccOhgdAw/NHR1CWJ995r2xyJABFKH0Fj/nuI9yWVWzi1YrdycBOnPmrSIiJ3+o4xrjPzkzr4qEpeSxbI1XQh4ZMep9tH+vK2T7rU28oM/+JJ3kLRy7EmlL1kj/n4LpyaEVn639w8XprTX9CDdhhFOkCAcu8zOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=oJrLjLQo; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oJrLjLQo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733247654; x=1764783654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hCXkJobN9Y7lj3B9E3KE7PpBF8wrRPXTUlkmt82YSlU=; b=oJrLjLQouqhbXG5pbCwaANacmYYubsnV/Vg2MY7FSYav0WBxXkmps8S+ Yk46Z3zeV7jJteSmmTyck3nDym8ZgCG3u2WVvdGCaJFnSq9Y7oj2+PG75 RLZ4W1W7Gg/Fc1XS6zZXouEOQ1/69Uk7Iu8t8FFK6J5TLXyp79NscHszh KI6ffpnsXTbCAVtTTxCGamUGwCMhB+wwulX3UldYqK+MgRhLN7t0jhqma UDxbRdA0GxNsaCeFf5X47k4WNWpz/HV3s7oFg8mYmiVUwlRJz9iPVovC3 ZNfHZRdeX9HKAUY0cwvlMM5yGC8krAJOqQsW04mYKZiAbx2aqTenMuu+b Q==; X-CSE-ConnectionGUID: TKZ60ukqSiylW41U3ibCxw== X-CSE-MsgGUID: oC7JNdkgRQKvMB0Gq185xA== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="37135281" X-IronPort-AV: E=Sophos;i="6.12,205,1728975600"; d="scan'208";a="37135281" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 09:40:54 -0800 X-CSE-ConnectionGUID: 2zrK6qLoQauoxzNv2bxOLg== X-CSE-MsgGUID: 7WiInC6lQbG5Jr+sYX/tZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,205,1728975600"; d="scan'208";a="124336996" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orviesa002.jf.intel.com with ESMTP; 03 Dec 2024 09:40:50 -0800 From: Alexander Lobakin To: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko Cc: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Maciej Fijalkowski , Stanislav Fomichev , Magnus Karlsson , nex.sw.ncis.osdt.itp.upstreaming@intel.com, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v6 01/10] xsk: align &xdp_buff_xsk harder Date: Tue, 3 Dec 2024 18:37:24 +0100 Message-ID: <20241203173733.3181246-2-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241203173733.3181246-1-aleksander.lobakin@intel.com> References: <20241203173733.3181246-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org After the series "XSk buff on a diet" by Maciej, the greatest pow-2 which &xdp_buff_xsk can be divided got reduced from 16 to 8 on x86_64. Also, sizeof(xdp_buff_xsk) now is 120 bytes, which, taking the previous sentence into account, leads to that it leaves 8 bytes at the end of cacheline, which means an array of buffs will have its elements messed between the cachelines chaotically. Use __aligned_largest for this struct. This alignment is usually 16 bytes, which makes it fill two full cachelines and align an array nicely. ___cacheline_aligned may be excessive here, especially on arches with 128-256 byte CLs, as well as 32-bit arches (76 -> 96 bytes on MIPS32R2), while not doing better than _largest. Signed-off-by: Alexander Lobakin Reviewed-by: Toke Høiland-Jørgensen --- include/net/xsk_buff_pool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h index bb03cee716b3..7637799b6c19 100644 --- a/include/net/xsk_buff_pool.h +++ b/include/net/xsk_buff_pool.h @@ -29,7 +29,7 @@ struct xdp_buff_xsk { dma_addr_t frame_dma; struct xsk_buff_pool *pool; struct list_head list_node; -}; +} __aligned_largest; #define XSK_CHECK_PRIV_TYPE(t) BUILD_BUG_ON(sizeof(t) > offsetofend(struct xdp_buff_xsk, cb)) #define XSK_TX_COMPL_FITS(t) BUILD_BUG_ON(sizeof(struct xsk_tx_metadata_compl) > sizeof(t))