From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
"Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>,
"Bruce Richardson" <bruce.richardson@intel.com>
Subject: RE: [PATCH 00/61] reduce use of rte_memcpy
Date: Thu, 20 Aug 2026 11:03:13 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65A01@smartserver.smartshare.dk> (raw)
In-Reply-To: <42ecbb8129514f52b456549ee66757b2@huawei.com>
> From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com]
>
> > About replacing rte_memcpy with memcpy()...
> >
> > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > Sent: Thursday, 20 August 2026 07.12
> > >
> > > The DPDK function rte_memcpy() only exists as an optimization
> > > for shortcomings in performance of libc memcpy() on some platforms.
> >
> > Yes, and those platforms should benefit from it.
> >
> > E.g. the vhost performance improvements for Haswell and Broadwell
> [1].
> > Where similar performance improvements implemented in the relevant
> > compilers (GCC, Clang, MSVC)?
> >
> > [1]:
> >
> https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
> > 3675fa
> >
> > IMO, performance should remain a high priority for DPDK.
>
> As I can read the series, good few of them do remove rte_memcpy from
> the CP,
> where it is clearly irrelevant.
Agree!
> For those on the DP, at least for some of them we can run perf tests:
> let say for hash we do have perf_autotest which can be used to measure
> the
> perf diff. If there is none, or neglectable - then no point to keep
> rte_memcpy here.
Unless that perf test is run on all platforms, the result only shows perf diff on the tested platforms.
>
> >
> > > Many platforms have no special rte_memcpy() and just use memcpy().
> > >
> > > But many analysis and test tools know that memcpy() is a special
> > > case and check for overwrite, bounds errors etc. Therefore memcpy()
> > > should be preferred wherever possible.
> >
> > I think this is the only substantial benefit of replacing
> rte_memcpy() with
> > memcpy()!
> > Could we reap this benefit by having special builds for such tools,
> where
> > rte_memcpy() is modified to use memcpy() instead?
> > Then we wouldn't have to compromise on performance.
> >
> > Also, rte_memcpy() used to have a pragma disabling bounds checks due
> to some
> > Intel drivers using [0] instead of []; the pragma was removed from
> rte_memcpy()
> > when the Intel drivers were fixed.
> > I'm not sufficiently familiar with analysis/test tools to say what
> they can detect
> > when using memcpy() instead of the copy methods used by rte_memcpy().
> >
> > >
> > > This patch series introduces a coccinelle script to find
> > > calls to rte_memcpy() where size is fixed, and change them to
> > > regular memcpy(). This was the starting point for this cleanup.
> > >
> > > There is also some cleanups to include rte_memcpy.h and string.h
> > > where needed. Often the includes were happening by some other
> > > header. And also removal of rte_memcpy.h where no longer needed.
> > >
> > > The result is a 46% reduction in use of rte_memcpy.
> > > The remaining rte_memcpy can be cleaned up later:
> > > - drivers with active maintenance (like mlx5);
> > > - changes to rte_memcpy which need benchmarking;
> > > - test code for rte_memcpy can be removed as last step.
> > >
> > > No functional change, no warnings in all compilers including LTO.
> >
> > memcpy() does not always use inline vector instructions for fixed
> size copy [2].
> >
> > [2]:
> > https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
> > rtserver.smartshare.dk/
> >
> >
> > Another disadvantage of rte_memcpy() is the lack of developer
> guidance.
> > It is not well documented when to use rte_memcpy() and when to use
> memcpy().
> > We discussed something similar on the Tech Board meeting yesterday;
> it is not
> > well documented when to use which type of "ring" (normal, RTS, HTS),
> so maybe
> > we could remove one of them.
> > But removing an option is not an improvement, if the removed option
> would
> > have been the better choice for some use cases.
> >
> > PS: The general guidance for rte_memcpy() usage is something like:
> > rte_memcpy() only in fast path,
> > memcpy() everywhere else,
> > assignment "=" when copying fixed size structures.
>
> I suppose for te_memcpy() we can be even more strict:
> Use it only for DP, and only after measurement, that shows
> clear perf improvement over ordinal memcpy().
> Alnd also ask contributors to document it (in the comments), i.e.:
> /* on <platform testsed> rte_memcpy() gives X% perf boost when doing
> ...*/
> rte_memcpy(...);
Disagree!
DPDK has performance optimized libs and functions.
Developers should not need to document that using a DPDK function is faster than using a libc function.
We don't require perf measurements for using DPDK rte_hash instead of libc hashmap.
I agree about not using rte_memcpy() in the control plane.
And I support Stephen's effort to clean this up.
But why the eagerness to avoid using rte_memcpy() in the fast path?
next prev parent reply other threads:[~2026-08-20 9:03 UTC|newest]
Thread overview: 146+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 5:11 [PATCH 00/61] reduce use of rte_memcpy Stephen Hemminger
2026-08-20 5:11 ` [PATCH 01/61] devtools/cocci: add script to replace fixed size rte_memcpy Stephen Hemminger
2026-08-20 5:11 ` [PATCH 02/61] app/testpmd: replace rte_memcpy with memcpy Stephen Hemminger
2026-08-20 5:11 ` [PATCH 03/61] test: use memcpy instead of rte_memcpy Stephen Hemminger
2026-08-20 6:22 ` Morten Brørup
2026-08-20 16:22 ` Stephen Hemminger
2026-08-21 6:37 ` Morten Brørup
2026-08-20 5:11 ` [PATCH 04/61] app/graph: replace rte_memcpy with memcpy Stephen Hemminger
2026-08-20 5:11 ` [PATCH 05/61] lpm: remove unnecessary include of rte_memcpy.h Stephen Hemminger
2026-08-20 5:11 ` [PATCH 06/61] acl: " Stephen Hemminger
2026-08-20 5:11 ` [PATCH 07/61] drivers/bus: " Stephen Hemminger
2026-08-20 5:11 ` [PATCH 08/61] security: replace fixed size rte_memcpy Stephen Hemminger
2026-08-20 5:11 ` [PATCH 09/61] ethdev: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 10/61] net: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 11/61] pdcp: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 12/61] eventdev: replace fixed size rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 13/61] eal: replace rte_memcpy of cpuset Stephen Hemminger
2026-08-20 5:12 ` [PATCH 14/61] cryptodev: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 15/61] drivers/raw: use memcpy for fixed size data Stephen Hemminger
2026-08-20 5:12 ` [PATCH 16/61] test-pipeline: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 17/61] net/af_xdp: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 18/61] net/avp: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 19/61] net/axgbe: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 20/61] net/bnx2x: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 21/61] net/bnxt: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 22/61] net/bonding: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 23/61] net/cnxk: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 24/61] net/cxgbe: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 25/61] net/dpaa2: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 26/61] net/enic: " Stephen Hemminger
2026-08-20 9:05 ` Hyong Youb Kim (hyonkim)
2026-08-20 5:12 ` [PATCH 27/61] net/failsafe: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 28/61] net/gve: " Stephen Hemminger
2026-08-20 20:42 ` Joshua Washington
2026-08-20 5:12 ` [PATCH 29/61] net/hinic: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 30/61] net/hns3: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 31/61] net/mlx5: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 32/61] net/mvpp2: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 33/61] net/netvsc: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 34/61] net/nfp: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 35/61] net/ngbe: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 36/61] net/ntnic: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 37/61] net/null: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 38/61] net/qede: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 39/61] net/ring: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 40/61] net/sfc: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 41/61] net/txgbe: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 42/61] net/vhost: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 43/61] net/virtio: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 44/61] net/sxe2: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 45/61] net/zxdh: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 46/61] net/memif: use memcpy for fixed size data Stephen Hemminger
2026-08-20 5:12 ` [PATCH 47/61] net/ice: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 48/61] test-bbdev: remove unnecessary include rte_memcpy.h Stephen Hemminger
2026-08-20 5:12 ` [PATCH 49/61] drivers/mempool: use memcpy for fixed size data Stephen Hemminger
2026-08-20 5:12 ` [PATCH 50/61] ml/cnxk: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 51/61] drivers/event: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 52/61] baseband/la12xx: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 53/61] baseband/acc: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 54/61] drivers/*/qat: use memcpy for fixed size data Stephen Hemminger
2026-08-20 5:12 ` [PATCH 55/61] hash: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 56/61] rib: remove rte_memcpy include Stephen Hemminger
2026-08-20 5:12 ` [PATCH 57/61] pcapng: replace use of rte_memcpy Stephen Hemminger
2026-08-20 5:12 ` [PATCH 58/61] efd: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 59/61] net/xsc: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 60/61] net/pcap: " Stephen Hemminger
2026-08-20 5:12 ` [PATCH 61/61] power: " Stephen Hemminger
2026-08-20 7:31 ` [PATCH 00/61] reduce " Morten Brørup
2026-08-20 8:16 ` Bruce Richardson
2026-08-20 8:46 ` Konstantin Ananyev
2026-08-20 9:03 ` Morten Brørup [this message]
2026-08-20 13:07 ` Konstantin Ananyev
2026-08-20 14:00 ` Morten Brørup
2026-08-20 20:13 ` Stephen Hemminger
2026-08-20 20:16 ` Stephen Hemminger
2026-08-20 20:18 ` Stephen Hemminger
2026-08-21 19:23 ` [PATCH v2 00/68] " Stephen Hemminger
2026-08-21 19:23 ` [PATCH v2 01/68] devtools/cocci: add script to replace fixed size rte_memcpy Stephen Hemminger
2026-08-21 19:23 ` [PATCH v2 02/68] lib: add missing include of rte_memcpy.h Stephen Hemminger
2026-08-21 19:23 ` [PATCH v2 03/68] net: " Stephen Hemminger
2026-08-21 19:23 ` [PATCH v2 04/68] crypto: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 05/68] drivers: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 06/68] app: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 07/68] examples: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 08/68] eal: document when to use rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 09/68] app/testpmd: replace rte_memcpy with memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 10/68] test: use memcpy instead of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 11/68] app/graph: replace rte_memcpy with memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 12/68] lpm: remove unnecessary include of rte_memcpy.h Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 13/68] acl: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 14/68] drivers/bus: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 15/68] security: replace fixed size rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 16/68] ethdev: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 17/68] net: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 18/68] pdcp: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 19/68] eventdev: replace fixed size rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 20/68] eal: replace rte_memcpy of cpuset Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 21/68] cryptodev: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 22/68] drivers/raw: use memcpy for fixed size data Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 23/68] test-pipeline: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 24/68] net/af_xdp: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 25/68] net/avp: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 26/68] net/axgbe: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 27/68] net/bnx2x: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 28/68] net/bnxt: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 29/68] net/bonding: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 30/68] net/cnxk: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 31/68] net/cxgbe: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 32/68] net/dpaa2: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 33/68] net/enic: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 34/68] net/failsafe: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 35/68] net/gve: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 36/68] net/hinic: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 37/68] net/hns3: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 38/68] net/mlx5: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 39/68] net/mvpp2: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 40/68] net/netvsc: " Stephen Hemminger
2026-08-21 20:08 ` [EXTERNAL] " Long Li
2026-08-21 19:24 ` [PATCH v2 41/68] net/nfp: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 42/68] net/ngbe: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 43/68] net/ntnic: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 44/68] net/null: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 45/68] net/qede: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 46/68] net/ring: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 47/68] net/sfc: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 48/68] net/txgbe: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 49/68] net/vhost: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 50/68] net/virtio: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 51/68] net/sxe2: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 52/68] net/zxdh: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 53/68] net/memif: use memcpy for fixed size data Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 54/68] net/ice: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 55/68] test-bbdev: remove unnecessary include rte_memcpy.h Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 56/68] drivers/mempool: use memcpy for fixed size data Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 57/68] ml/cnxk: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 58/68] drivers/event: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 59/68] baseband/la12xx: " Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 60/68] baseband/acc: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 61/68] drivers/*/qat: use memcpy for fixed size data Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 62/68] hash: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 63/68] rib: remove rte_memcpy include Stephen Hemminger
2026-08-21 19:24 ` [PATCH v2 64/68] pcapng: replace use of rte_memcpy Stephen Hemminger
2026-08-21 19:25 ` [PATCH v2 65/68] efd: " Stephen Hemminger
2026-08-21 19:25 ` [PATCH v2 66/68] net/xsc: " Stephen Hemminger
2026-08-21 19:25 ` [PATCH v2 67/68] net/pcap: " Stephen Hemminger
2026-08-21 19:25 ` [PATCH v2 68/68] power: " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F65A01@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.