[PATCH v3] linux-gen: stash: add optimized implementations per put_mode/get_mode#2358
Merged
Conversation
| uint32_t size = ring_mask + 1; | ||
|
|
||
| /* Load acquire of r_tail ensures it is read after w_head, so that | ||
| * w_head - r_tail <= size. */ |
Collaborator
There was a problem hiding this comment.
As in _RING_MPSC_DEQ_MULTI, this comment is inaccurate and misleading. w_head is only accessed by the producer thread so the loaded value is always the last written value, regardless of how the load gets ordered with respect to the load of r_tail. The value written to w_head never exceeds old_head + num_free, which equals size + r_rtail, so w_head - r_tail cannot exceed size.
Collaborator
Author
There was a problem hiding this comment.
Comment fixed in V3.
| uint32_t head, tail, new_head, i; | ||
|
|
||
| /* Load acquire of w_tail ensures it is read after r_head, so that head | ||
| * value is always behind or equal to tail value. */ |
Collaborator
There was a problem hiding this comment.
Same comment about the load acquire here as for _RING_MPSC_RST_DEQ_MULTI
Collaborator
Author
There was a problem hiding this comment.
Comment fixed in V3.
Move ring headers into a separate directory, so they don't clutter the main header directory. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Add dedicated MPSC and SPMC ring variants based on the MPMC ring implementation. No functional changes to the MPMC implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Utilize MPSC and SPMC ring variants for non-strict stash implementation when put_mode or get_mode is ODP_STASH_OP_ST. This reduces unnecessary synchronization overhead. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Add uint64_t variant of single thread ring. Also, remove deprecated comments about 'max_num' having to be smaller than ring size and add batch variants of enqueue and dequeue functions. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Utilize single thread ring for stash implementation in ODP_STASH_OP_LOCAL mode. This removes unnecessary synchronization overhead. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Add dedicated MPSC and SPMC restricted ring variants based on the MPMC restricted ring implementation. No functional changes to the current MPMC implementation. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Utilize MPSC and SPMC restricted ring variants for strict stash implementation when put_mode or get_mode is ODP_STASH_OP_ST. This reduces unnecessary multi-producer/consumer synchronization overhead. Also, rename MPMC restricted ring wrappers and data to match the current naming style. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Drop the inline specifier from the ring helper functions. These are only referenced through function pointers, so inlining has no effect and the qualifier is misleading. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Add uint64_t variant of SPSC ring. Also, add batch variants of enqueue and dequeue functions, and remove deprecated comments about 'max_num' having to be smaller than ring size Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
Utilize SPSC ring implementation for stashes that have both put_mode and get_mode set to ODP_STASH_OP_ST. This reduces unnecessary synchronization overhead. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
JannePeltonen
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
V2: