[PATCH 22.11] lib/mempool : rte_mempool_avail_count, fixing return bigger than mempool size
Yasin CANER
yasinncaner at gmail.com
Tue May 16 08:10:09 CEST 2023
From: Yasin CANER <yasin.caner at 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.
Bugzilla ID: 1229
Signed-off-by: Yasin CANER <yasin.caner at ulakhaberlesme.com.tr>
---
lib/mempool/rte_mempool.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index cf5dea2304..57b393c9ff 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -1009,8 +1009,11 @@ rte_mempool_avail_count(const struct rte_mempool *mp)
count = rte_mempool_ops_get_count(mp);
- if (mp->cache_size == 0)
+ if (mp->cache_size == 0){
+ if (count > mp->size)
+ return mp->size;
return count;
+ }
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
count += mp->local_cache[lcore_id].len;
--
2.25.1
More information about the stable
mailing list