ring: optimize empty test
authorMorten Brørup <mb@smartsharesystems.com>
Tue, 19 May 2020 15:27:25 +0000 (15:27 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 1 Jul 2020 09:46:09 +0000 (11:46 +0200)
commit4b7284a71f64f69a55692a2c2018f5c60c49b226
treed2418ce878045ac328dec088e680afd6ae479988
parent36e3cfbbefcfec8174479282f7632885ee37324e
ring: optimize empty test

Testing if the ring is empty is as simple as comparing the producer and
consumer pointers.

In theory, this optimization reduces the number of potential cache misses
from 3 to 2 by not having to read r->mask in rte_ring_count().

The modification of this function were also discussed in the RFC here:
https://mails.dpdk.org/archives/dev/2020-April/165752.html

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_ring/rte_ring.h