From patchwork Fri Oct 30 17:29:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82972 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E1A9A04E6; Fri, 30 Oct 2020 18:35:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F0EB77CC8; Fri, 30 Oct 2020 18:30:46 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id D1B3E6A1C for ; Fri, 30 Oct 2020 18:30:17 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 854195C0210; Fri, 30 Oct 2020 13:30:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:30:17 -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=VD0izMzLMnUVKClulB0vY6wFd8cet v3uOsN1IwDovciiXman8IUmIgHZpLXUvIGb8VKYedLXYWL8qO7tumr9VYrLIwlUi uvPYvY2V2JSJnpg7lbvjOkrvVw3JUCkul5V33ySR8JblIb5/BTq9yO8qGkh/YMwH JKZxeeV23g+Gkrkt6g+q5iBrjwaa4VGSSkk12o39YeAr3Vv9NvahVnaHT8OjkQ9r cnJfsP13z+5a9XdEnkh78ZZO0MuH5tJZ6NN2lYEti6nIHrhowQysBdIPHxqhWTI9 0OvYLVznxgj4TmfCLb1OsBZuji5EsuGup9pd9JmnL1fso+5Nai6QgjiRw== 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=S8mmrMfg 9ZBLVCwu1wAbMVsI/V8PxkzyvFzQ8gMbobj0j7CDHCPamSauwmHFiveRYg0kdV/Q 9xOISHTMx/mXtwDxMTP7gvoheIBgJB1dv0ThPiO+phQ5N6eipga8DOrAY3aEfJga DpxClg0mFflFMmT4PHJlKDQujSPy0VKrk0PJPZrCbkrjlIoK/HJgqsjLcaEM4jmH 5+cbKfbqVZZSZU+7uP12QtTSloyP9ERREgrbVM76Fl67J5tmzsnq3NtpWFyEi/3l PsyScYPT5FKe+POqPMZD7F9DFa2xTcW3+7i6dnWMchKnxhz6BCajU0/6DIwxpA84 UiwC5agpP6hIQQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdeliecutefuodetggdotefrodftvf 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 22D2E3064684; Fri, 30 Oct 2020 13:30:16 -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, akhil.goyal@nxp.com, jerinj@marvell.com, Ray Kinsella , Neil Horman Date: Fri, 30 Oct 2020 18:29:40 +0100 Message-Id: <20201030172940.1073558-16-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030172940.1073558-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030172940.1073558-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 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; /**