[PATCH v3 1/2] stack: introduce pile
Konstantin Ananyev
konstantin.ananyev at huawei.com
Mon Aug 31 10:50:14 CEST 2026
> 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.
Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
The code itself looks ok to me, thought I still think it is worth to consider
moving lf_pile (and lf_stack) DP implementation in .c, to avoid each rte_stack_pus/pop
to inline all three of them.
My speculation is that the perf diff for bulk enqueue/dequeue because of
that would be negligible, while both are quite big for inlining them always
(specially lf_pile).
> Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
> ---
More information about the dev
mailing list