From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [Bug 1229] rte_mempool_avail_count : returns bigger than mempool size
Date: Thu, 11 May 2023 14:00:29 +0000 [thread overview]
Message-ID: <bug-1229-3@http.bugs.dpdk.org/> (raw)
[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]
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@dpdk.org
Reporter: yasinncaner@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.
[-- Attachment #2: Type: text/html, Size: 3615 bytes --]
next reply other threads:[~2023-05-11 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 14:00 bugzilla [this message]
2023-05-18 8:56 ` bugzilla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-1229-3@http.bugs.dpdk.org/ \
--to=bugzilla@dpdk.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).