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 9205EA052B; Tue, 28 Jul 2020 19:46:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23C11A69; Tue, 28 Jul 2020 19:46:42 +0200 (CEST) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id 7C2F72AB for ; Tue, 28 Jul 2020 19:46:40 +0200 (CEST) Received: by mail-pj1-f65.google.com with SMTP id f9so229703pju.4 for ; Tue, 28 Jul 2020 10:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rSZlq3L2dHYSyOesoYCBNVUnYGnAukSkTRrTD1Kc1AU=; b=XsLdeDNpAjagHS+zoVs1582Mv9TlF1Ebb22wtMLqXnYBp8H0vgRgd2LGcDlBS9Y7qr 7K+EF2rQYdJJnJnN9pnrE21LJ+y+3wgn/5EXFBV/5m0zay5SLIr75jRCr4VyryMDF6XI 4CEa5NZz2ABgPpSD4sU4CGlj16BpypMVhHWa90Mu3ilinIOoVCLMkFLqoiTZPY47ae2P u4gw/Ma3NgFxVJTZxiuaXbfncg7sFCMYyrPACqAzQXasXP3gEIB4bD6vj0gKO2L/Vrnj JB7CruvffLdHt6tnhj8W728iTziOzT0jQb2tWXSdqMfJW80khmaMs5OuZsbxTMOj72YI 1heA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rSZlq3L2dHYSyOesoYCBNVUnYGnAukSkTRrTD1Kc1AU=; b=WVC0Q2kxCuv/69ZXebrBa/OXxoEJTPb4QzV3p+y0oAqygRLsOckOVdMxKMZ6h9FO4S gTp1bEOFDAlRfn7o/oOTtXm1zqhRPK+chZKUMOx1wvj218dAUk2tFERvIOl1Rn9HMQHv KD7s0n66T+CJo+U+2Fg1MeJ9rCIltvDcw0QhugRx4DHWvhesi7lIbhAe3HvNdt+ClT+y ntbjWQ+6hofESN3noqrBKn6ziJuxOhFyHEswe18AkRhkb9ZgHylGy8Wi7hlJW3DY8gX/ VBD1HUoI/SxMMv8fygKisVuk709EQhD/9DuY9vQ72gWFDznnFjnBr6qvB4NkHvkcbusM oI5A== X-Gm-Message-State: AOAM532c+jvEQZ2g/q8QreC6YOhTAzx7VXc6YTbj9TmmA5r23OCk4EY5 JgbqEQTtey8v45G4xwaMzOmYvA== X-Google-Smtp-Source: ABdhPJwYNUknuc8yQrDLNTR2SRe5MR6qio5XOwYrsJ3jD7t4gFWMq9wjS1GyypH1RKxWgl4dxyi8Bg== X-Received: by 2002:a17:90a:764c:: with SMTP id s12mr5543492pjl.201.1595958399290; Tue, 28 Jul 2020 10:46:39 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id u14sm18759808pgf.51.2020.07.28.10.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 10:46:39 -0700 (PDT) Date: Tue, 28 Jul 2020 10:46:24 -0700 From: Stephen Hemminger To: Sarosh Arif Cc: olivier.matz@6wind.com, dev@dpdk.org Message-ID: <20200728104624.3541fba8@hermes.lan> In-Reply-To: <20200723070240.14749-1-sarosh.arif@emumba.com> References: <20200723070240.14749-1-sarosh.arif@emumba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mbuf: replace c memcpy() code semantics with optimized rte_memcpy() 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" On Thu, 23 Jul 2020 12:02:40 +0500 Sarosh Arif wrote: > Since rte_memcpy is more optimized it should be used instead of memcpy > > Signed-off-by: Sarosh Arif The part in pkmbuf_pool_init is not performance critical. The layout of rte_mbuf_dynfield is sub optimal. struct rte_mbuf_dynfield { char name[64]; /* 0 64 */ /* --- cacheline 1 boundary (64 bytes) --- */ size_t size; /* 64 8 */ size_t align; /* 72 8 */ unsigned int flags; /* 80 4 */ /* size: 88, cachelines: 2, members: 4 */ /* padding: 4 */ /* last cacheline: 24 bytes */ }; 1. It should have been sized so that overall it was 64 bytes. 2. Use 8 bytes for size and align is wasteful. 3. Hold 4 bytes for future flags is also wasteful. YAGNI If you look at assembly output on x86 the copy of params becomes a sequence of vmovups instructions with Gcc. For 20.11 maybe: diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h index 8407230ecfdc..eb1d01f97f40 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.h +++ b/lib/librte_mbuf/rte_mbuf_dyn.h @@ -70,16 +70,16 @@ /** * Maximum length of the dynamic field or flag string. */ -#define RTE_MBUF_DYN_NAMESIZE 64 +#define RTE_MBUF_DYN_NAMESIZE 60 /** * Structure describing the parameters of a mbuf dynamic field. */ struct rte_mbuf_dynfield { char name[RTE_MBUF_DYN_NAMESIZE]; /**< Name of the field. */ - size_t size; /**< The number of bytes to reserve. */ - size_t align; /**< The alignment constraint (power of 2). */ - unsigned int flags; /**< Reserved for future use, must be 0. */ + uint8_t size; /**< The number of bytes to reserve. */ + uint8_t align; /**< The alignment constraint (power of 2). */ + uint16_t flags; /**< Reserved for future use, must be 0. */ }; /** Or make the dynamic field dynamic size to avoid wasting space?