From: Bruce Richardson <bruce.richardson@intel.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] stack: introduce pile
Date: Thu, 13 Aug 2026 12:50:27 +0100 [thread overview]
Message-ID: <an2vg8NMp9MRtbwO@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35F659DC@smartserver.smartshare.dk>
On Wed, Aug 12, 2026 at 06:28:36PM +0200, Morten Brørup wrote:
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > Sent: Wednesday, 12 August 2026 18.16
> >
> > On Wed, Aug 12, 2026 at 06:01:31PM +0200, Morten Brørup wrote:
> > > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > > Sent: Wednesday, 12 August 2026 16.34
> > > >
> > > > On Wed, Aug 12, 2026 at 01:47:56PM +0000, Morten Brørup wrote:
> > > > > Added a new high-performance lock-free "pile", using the Stack
> > API.
> > > > > The pile behaves roughly like a stack, but is not strictly LIFO.
> > > > >
> > > > > The pile is optimized for pushing/popping bulks of objects, which
> > > > > it does significantly faster than the lock-free stack.
> > > > >
> > > > > Pushing/popping a number of objects not divisible by the compile
> > time
> > > > > configurable bulk size is handled gracefully, but not as fast as
> > > > > complete bulks.
> > > > >
> > > > > Performance examples, stack_pile_perf_autotest vs.
> > stack_lf_autotest:
> > > > >
> > > > > On a single core, pushing/popping 1 or 8 objects is similar
> > speed.
> > > > > On a single core, pushing/popping 32 objects is 2x faster.
> > > > > On a single core, pushing/popping 512 objects is 10x faster.
> > > > >
> > > > > On four cores, pushing/popping 1, 8 or 32 objects is slightly
> > faster.
> > > > > On four cores, pushing/popping 512 objects is 4x faster.
> > > > >
> > > > How does it differ, or what are the benefits vs the standard stack.
> > >
> > > The standard stack is generally faster on single core.
> > > Only pushing/popping 512 objects is slightly faster than the standard
> > stack, but maybe the standard stack could be microoptimized to fix
> > that.
> > >
> > > On four cores, it is slightly faster than the standard stack with
> > multiple objects:
> > >
> > > stack_perf_autotest
> > > Average cycles per object push/pop (bulk size: 1): 3806.65
> > > Average cycles per object push/pop (bulk size: 8): 554.77
> > > Average cycles per object push/pop (bulk size: 32): 144.70
> > > Average cycles per object push/pop (bulk size: 512): 13.52
> > >
> > > stack_pile_perf_autotest
> > > Average cycles per object push/pop (bulk size: 1): 4012.39
> > > Average cycles per object push/pop (bulk size: 8): 459.82
> > > Average cycles per object push/pop (bulk size: 32): 122.40
> > > Average cycles per object push/pop (bulk size: 512): 9.60
> > >
> > >
> > > > The
> > > > LF
> > > > stack I'd view as a strange edge case, since even with the standard
> > > > MP/MC
> > > > ring mempool driver you still have atomics on the fast-path and you
> > > > will
> > > > still get stalls if a thread gets context switched out in the
> > middle of
> > > > a
> > > > mempool operation.
> > >
> > > Yes, the no-stall guarantee is a key benefit of the lock-free stack
> > and the pile.
> > >
> >
> > Ok, that is good. Next question, rather than adding a whole new mempool
> > driver implementation, can we use this to replace one of the existing
> > stack
> > implementations? Do we need to have so many mempool stack drivers
> > generally?
>
> We could consider replacing the lock-free stack implementation by the pile implementation, but the pile is not strictly LIFO, so it seems risky.
>
> For a mempool holding mbufs, there's probably no harm in the difference.
> But for a mempool holding some other object type, it could be harmful. I don't know.
> IMO, not worth the risk.
>
> Good idea, though!
> I'm usually in favor of cleaning up. Just not this one. :-)
>
Having not reviewed the code yet, I can't fully comment, but I would look
for a strong differentiator before adding yet another stack implementation
to DPDK. Just because it's not strictly LIFO doesn't rule-out it being
a drop-in replacement for the existing stack_lf implementation, for
example, so long as it's pretty close. We have a habit of accumulating lots
of different implementations of things with slight variances, leading both
to having lots of stuff to maintain and also then to confusion from users
as to what to use. Therefore, as we look to have "better" implementations
of structures, I believe that we should always replace old with new, rather
than just adding new alongside old all the time - unless there is a very
strong reason not to.
Hope to review your new implementation in the coming days, and hope to have
more feedback then.
Thanks,
/Bruce
prev parent reply other threads:[~2026-08-13 11:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:47 [PATCH] stack: introduce pile Morten Brørup
2026-08-12 14:34 ` Bruce Richardson
2026-08-12 16:01 ` Morten Brørup
2026-08-12 16:15 ` Bruce Richardson
2026-08-12 16:28 ` Morten Brørup
2026-08-13 11:50 ` Bruce Richardson [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=an2vg8NMp9MRtbwO@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.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