> From: David Marchand [mailto:david.march...@redhat.com] > Sent: Wednesday, 17 May 2023 13.53 > > On Wed, May 17, 2023 at 11:05 AM Morten Brørup <m...@smartsharesystems.com> > wrote: > > > On Tue, 16 May 2023 13:41:46 +0000 > > > Yasin CANER <yasinnca...@gmail.com> wrote: > > > > > > > From: Yasin CANER <yasin.ca...@ulakhaberlesme.com.tr> > > > > > > > > after a while working rte_mempool_avail_count function returns bigger > > > > than mempool size that cause miscalculation rte_mempool_in_use_count. > > > > > > > > it helps to avoid miscalculation rte_mempool_in_use_count. > > Is this issue reproduced with an application of the reporter, or a > DPDK in-tree application? > > > > > > > > > > Bugzilla ID: 1229 > > > > > > > > Signed-off-by: Yasin CANER <yasin.ca...@ulakhaberlesme.com.tr> > > > > > > An alternative that avoids some code duplication. > > > > > > diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c > > > index cf5dea2304a7..2406b112e7b0 100644 > > > --- a/lib/mempool/rte_mempool.c > > > +++ b/lib/mempool/rte_mempool.c > > > @@ -1010,7 +1010,7 @@ rte_mempool_avail_count(const struct rte_mempool > > > *mp) > > > count = rte_mempool_ops_get_count(mp); > > > > > > if (mp->cache_size == 0) > > > - return count; > > > + goto exit; > > > > This bug can only occur here (i.e. with cache_size==0) if > rte_mempool_ops_get_count() returns an incorrect value. The bug should be > fixed there instead. > > > > > > > > MB (continued): The bug must be in the underlying mempool driver. I took a > look at the ring and stack drivers, and they seem fine. > > Or it could indicate a double free (or equivalent) issue from the > application (either through direct call to mempool API, or indirectly > like sending/freeing an already sent/freed packet for example).
Good point, David. @Yasin, if you build DPDK and your application with RTE_LIBRTE_MEMPOOL_DEBUG set in config/rte_config.h, the mempool cookies should catch any double frees.