[PATCH] stack: introduce pile

Bruce Richardson bruce.richardson at intel.com
Wed Aug 12 16:34:01 CEST 2026


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 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.

/Bruce


More information about the dev mailing list