On Tue, Jan 11, 2022 at 12:38 PM Andrzej Ostruszka <a...@semihalf.com> 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 <a...@semihalf.com>
> Reviewed-by: Olivier Matz <olivier.m...@6wind.com>
> Acked-by: Konstantin Ananyev <konstantin.anan...@intel.com>
Reviewed-by: Morten Brørup <m...@smartsharesystems.com>

Applied, thanks.


-- 
David Marchand

Reply via email to