From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4F463A04DD; Thu, 29 Oct 2020 10:33:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64A49C9C8; Thu, 29 Oct 2020 10:28:46 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id D1F6CC910 for ; Thu, 29 Oct 2020 10:28:37 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 7063B952; Thu, 29 Oct 2020 05:28:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 05:28:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=wMX/E93HyuTvM uXvClkOlIfUAvqlLOyLGjVKvtFHR3c=; b=jCOT3Xe057Tc8rTAmPS1xHjtgakho Sh8jmeBfdwcCMHg0MUxTA+Fb4GZesCwjPAF3P9pGhKXHPokRkFcTt9lLx8kQWGxU 6+iiLIUbXmi/J4oTTlHOf6bhaAfCJ7CkzdZLXZpOOj0gODPIyUiYSanbxBgjHaH/ aOrfdW7eg5R9UWghxquzAXS6A2xq4rOYOSocBXs1ytX8muR5UY4FMzpyQwI6cTPy 5EO3oGCivaKhN+jTvx3Zp3JzgbwGKeYH1zgzSrOV6YB0+5OwLV7zt+cgo/jDwihh ZZc5D5LL2y61iNMd91cmr96kIJZW1gSzAh/LXTLzMREe1/vHLViBdNnng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=wMX/E93HyuTvMuXvClkOlIfUAvqlLOyLGjVKvtFHR3c=; b=F8mG2ttQ Yn9KfNrYTMYooERjHTfLCwJmRth82IH3eIo4s63DVFU+/tI5QfP1DOQZNhjMY3Qx O7F3vmOMRoUWS7smJRmJzM4662VPX/Q0qj648dW3Dv5aVJiJexrVsHpNglWkHY9h T8AqeWvHMfSH++EzLEHA+9muNCtfcFYhNZJppJKyeac9S/Vn1Z4DGUnZOFYGuq00 qyg5yrmjMTeFkY7YZi3m4aLwppzsTzLwxMarwtZhQQARvOg5O66Hw0oTeEXIyrnK wfTmh0K5oYCEK/9aGPZyWifam5xCXvmig+A3Sy6f0uzzMZqs1GL2A9qBYzUFt0i1 6+xH+AIY040Vqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D0ABB3280063; Thu, 29 Oct 2020 05:28:34 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, viacheslavo@nvidia.com, Ray Kinsella , Neil Horman Date: Thu, 29 Oct 2020 10:27:50 +0100 Message-Id: <20201029092751.3837177-16-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029092751.3837177-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 15/15] mbuf: move pool pointer in hotter first half X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The mempool pointer in the mbuf struct is moved from the second to the first half. It should increase performance on most systems having 64-byte cache line, i.e. mbuf is split in two cache lines. On such system, the first half (also called first cache line) is hotter than the second one where the pool pointer was. Moving this field gives more space to dynfield1. This is how the mbuf layout looks like (pahole-style): word type name byte size 0 void * buf_addr; /* 0 + 8 */ 1 rte_iova_t buf_iova /* 8 + 8 */ /* --- RTE_MARKER64 rearm_data; */ 2 uint16_t data_off; /* 16 + 2 */ uint16_t refcnt; /* 18 + 2 */ uint16_t nb_segs; /* 20 + 2 */ uint16_t port; /* 22 + 2 */ 3 uint64_t ol_flags; /* 24 + 8 */ /* --- RTE_MARKER rx_descriptor_fields1; */ 4 uint32_t union packet_type; /* 32 + 4 */ uint32_t pkt_len; /* 36 + 4 */ 5 uint16_t data_len; /* 40 + 2 */ uint16_t vlan_tci; /* 42 + 2 */ 5.5 uint64_t union hash; /* 44 + 8 */ 6.5 uint16_t vlan_tci_outer; /* 52 + 2 */ uint16_t buf_len; /* 54 + 2 */ 7 struct rte_mempool * pool; /* 56 + 8 */ /* --- RTE_MARKER cacheline1; */ 8 struct rte_mbuf * next; /* 64 + 8 */ 9 uint64_t union tx_offload; /* 72 + 8 */ 10 uint16_t priv_size; /* 80 + 2 */ uint16_t timesync; /* 82 + 2 */ uint32_t seqn; /* 84 + 4 */ 11 struct rte_mbuf_ext_shared_info * shinfo; /* 88 + 8 */ 12 uint64_t dynfield1[4]; /* 96 + 32 */ 16 /* --- END 128 */ Signed-off-by: Thomas Monjalon --- doc/guides/rel_notes/deprecation.rst | 5 ----- lib/librte_kni/rte_kni_common.h | 3 ++- lib/librte_mbuf/rte_mbuf_core.h | 5 ++--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 72dbb25b83..07ca1dcbb2 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -88,11 +88,6 @@ Deprecation Notices - ``seqn`` - As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged, - avoiding impact on vectorized implementation of the driver datapaths, - while evaluating performance gains of a better use of the first cache line. - - * ethdev: the legacy filter API, including ``rte_eth_dev_filter_supported()``, ``rte_eth_dev_filter_ctrl()`` as well as filter types MACVLAN, ETHERTYPE, FLEXIBLE, SYN, NTUPLE, TUNNEL, FDIR, diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h index 36d66e2ffa..ffb3182731 100644 --- a/lib/librte_kni/rte_kni_common.h +++ b/lib/librte_kni/rte_kni_common.h @@ -84,10 +84,11 @@ struct rte_kni_mbuf { char pad2[4]; uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ uint16_t data_len; /**< Amount of data in segment buffer. */ + char pad3[14]; + void *pool; /* fields on second cache line */ __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))) - void *pool; void *next; /**< Physical address of next mbuf in kernel. */ }; diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index 52ca1c842f..ee185fa32b 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -584,12 +584,11 @@ struct rte_mbuf { uint16_t buf_len; /**< Length of segment buffer. */ - uint64_t unused; + struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ /* second cache line - fields only used in slow path or on TX */ RTE_MARKER cacheline1 __rte_cache_min_aligned; - struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ struct rte_mbuf *next; /**< Next segment of scattered packet. */ /* fields to support TX offloads */ @@ -646,7 +645,7 @@ struct rte_mbuf { */ struct rte_mbuf_ext_shared_info *shinfo; - uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */ + uint64_t dynfield1[4]; /**< Reserved for dynamic fields. */ } __rte_cache_aligned; /** -- 2.28.0