From: Stephen Hemminger <stephen@networkplumber.org>
To: Rami Neiman <rami.neiman@solace.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Duane Pauls <Duane.Pauls@solace.com>
Subject: Re: Question: Why doesn’t rte_ring use double-mapped VMA to eliminate wraparound logic?
Date: Sat, 8 Nov 2025 09:14:08 -0800 [thread overview]
Message-ID: <20251108091408.584962e8@phoenix> (raw)
In-Reply-To: <SA1PR01MB82954E1727004B247E462C269BC3A@SA1PR01MB8295.prod.exchangelabs.com>
On Fri, 7 Nov 2025 16:57:37 +0000
Rami Neiman <rami.neiman@solace.com> wrote:
> 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.
Manipulating process mapping in user space is often non-portable, it is possible on Linux to use mmap
to do this but would require deep changes to the API.
prev parent reply other threads:[~2025-11-08 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 16:57 Rami Neiman
2025-11-08 17:14 ` Stephen Hemminger [this message]
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=20251108091408.584962e8@phoenix \
--to=stephen@networkplumber.org \
--cc=Duane.Pauls@solace.com \
--cc=dev@dpdk.org \
--cc=rami.neiman@solace.com \
/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).