On Tue, Jan 11, 2022 at 12:38 PM Andrzej Ostruszka <[email protected]> wrote: > When enqueueing/dequeueing to/from the ring we try to optimize by manual > loop unrolling. The check for this optimization looks like: > > if (likely(idx + n < size)) { > > where 'idx' points to the first usable element (empty slot for enqueue, > data for dequeue). The correct comparison here should be '<=' instead > of '<'. > > This is not a functional error since we fall back to the loop with > correct checks on indexes. Just a minor suboptimal behaviour for the > case when we want to enqueue/dequeue exactly the number of elements that > we have in the ring before wrapping to its beginning. > > Fixes: cc4b218790f6 ("ring: support configurable element size") > Fixes: 286bd05bf70d ("ring: optimisations") > > Signed-off-by: Andrzej Ostruszka <[email protected]> > Reviewed-by: Olivier Matz <[email protected]> > Acked-by: Konstantin Ananyev <[email protected]> Reviewed-by: Morten Brørup <[email protected]>
Applied, thanks. -- David Marchand

