DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rami Neiman <rami.neiman@solace.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Duane Pauls <Duane.Pauls@solace.com>
Subject: Question: Why doesn’t rte_ring use double-mapped VMA to eliminate wraparound logic?
Date: Fri, 7 Nov 2025 16:57:37 +0000	[thread overview]
Message-ID: <SA1PR01MB82954E1727004B247E462C269BC3A@SA1PR01MB8295.prod.exchangelabs.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2402 bytes --]

Hi all,
I have a design question regarding rte_ring that I didn’t find a historical rationale for in the archives.
Most modern high-perf ring buffers (e.g. some NIC drivers, some DB queue implementations, etc.) eliminate wrap-around branches by taking the ring’s element array and mapping two consecutive VA ranges to the same physical backing pages.
i.e. you allocate N elements, commit enough pages to cover N, then call mmap (or equivalent) again immediately following it, pointing to the same physical pages. So from the CPU’s POV the element array is logically [0 .. N*2) but physically it’s the same backing. Therefore a batch read/write can always be done as a single contiguous memcpy/CLD/STOS without conditionals, even if (head+bulk) exceeds N.
Pseudo illustration:

[phys buffer of N slots]
VA: [0 .. N) -> phys
VA: [N .. 2N) -> same phys


For multi-element enqueue/dequeue it eliminates the “if wrap → split” case entirely — you can always memcpy in one contiguous op.
Question:
Is there an explicit reason DPDK doesn’t use this technique for rte_ring?
e.g.

  *
portability? (hugepages / VFIO?)
  *
inability to rely on mmap trickery for hugepage backed memzones?
  *
NUMA locality considerations?
  *
historical reason: first gen ring didn’t bulk enqueue so the branch didn’t matter?
  *
reluctance to add VA aliasing because of security / introspection tooling / ASan issues?

I just want to understand the architectural trade that was made.
Because on 64-bit Linux, double-mapping a 1–2 MB region is pretty trivial, and bulk ops in DPDK are extremely common — it feels like an obvious microarchitectural win for the “hot ring” case.
So: is there a concrete blocker? or simply “no one pushed a patch because current perf was ‘good enough’”?
Pointers to prior mailing list discussion / patches would be appreciated.
Thanks,
Rami Neiman

________________________________
Confidentiality notice

This e-mail message and any attachment hereto contain confidential information which may be privileged and which is intended for the exclusive use of its addressee(s). If you receive this message in error, please inform sender immediately and destroy any copy thereof. Furthermore, any disclosure, distribution or copying of this message and/or any attachment hereto without the consent of the sender is strictly prohibited. Thank you.

[-- Attachment #2: Type: text/html, Size: 7188 bytes --]

             reply	other threads:[~2025-11-08 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 16:57 Rami Neiman [this message]
2025-11-08 17:14 ` 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=SA1PR01MB82954E1727004B247E462C269BC3A@SA1PR01MB8295.prod.exchangelabs.com \
    --to=rami.neiman@solace.com \
    --cc=Duane.Pauls@solace.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).