[Bug 1229] rte_mempool_avail_count : returns bigger than mempool size
bugzilla at dpdk.org
bugzilla at dpdk.org
Thu May 11 16:00:29 CEST 2023
https://bugs.dpdk.org/show_bug.cgi?id=1229
Bug ID: 1229
Summary: rte_mempool_avail_count : returns bigger than mempool
size
Product: DPDK
Version: 22.11
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: minor
Priority: Normal
Component: core
Assignee: dev at dpdk.org
Reporter: yasinncaner at gmail.com
Target Milestone: ---
Hello,
Sometimes rte_mempool_avail_count function returns bigger than mempool size
that cause mis-calculation/overflow/negative of in-use count (
rte_mempool_in_use_count)
11:51:48 NOTI [UseCount_mpool:00000065][avail_mpool:00010334]
11:51:48 NOTI [UseCount_mpool:4294967135][avail_mpool:00010560]
After adding a condition, it is fixed.
/* Return the number of entries in the mempool */
unsigned int
rte_mempool_avail_count(const struct rte_mempool *mp)
{
unsigned count;
unsigned lcore_id;
count = rte_mempool_ops_get_count(mp);
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;
/*
* due to race condition (access to len is not locked), the
* total can be greater than size... so fix the result
*/
if (count > mp->size){
return mp->size;
}
return count;
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20230511/37aa58ba/attachment.htm>
More information about the dev
mailing list