Re: [dpdk-dev] [PATCH] ring: empty and count optimizations

2020-05-14 Thread Morten Brørup
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Ananyev, > Konstantin > Sent: Thursday, May 14, 2020 6:47 PM > > > > > > -static inline unsigned > > > > +static inline unsigned int > > > > rte_ring_count(const struct rte_ring *r) > > > > { > > > > uint32_t prod_tail = r->prod.tail;

Re: [dpdk-dev] [PATCH] ring: empty and count optimizations

2020-05-14 Thread Ananyev, Konstantin
> > > > -static inline unsigned > > > +static inline unsigned int > > > rte_ring_count(const struct rte_ring *r) > > > { > > > uint32_t prod_tail = r->prod.tail; > > > uint32_t cons_tail = r->cons.tail; > > > uint32_t count = (prod_tail - cons_tail) & r->mask; > > > - return (count > r->c

Re: [dpdk-dev] [PATCH] ring: empty and count optimizations

2020-05-14 Thread Morten Brørup
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Ananyev, > Konstantin > Sent: Thursday, May 14, 2020 2:24 PM > > > Hi Morten, > > > Testing if the ring is empty is as simple as comparing the producer > and > > consumer pointers. > > In theory, this optimization reduces the number of poten

Re: [dpdk-dev] [PATCH] ring: empty and count optimizations

2020-05-14 Thread Ananyev, Konstantin
Hi Morten, > 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(). > > It is not possible to enqueue more elements t