From: Dmitry Vyal <dmitryvyal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: Looks like rte_mempool_free_count() and rte_mempool_count() are swapped
Date: Thu, 12 Sep 2013 11:52:35 +0400 [thread overview]
Message-ID: <523172C3.2040309@gmail.com> (raw)
Greetings.
I had a suspect I run into a mbuf depletion issue and decided to check
using rte_mempool_free_count(). To my surprise, it returned a value
equal to mempool size. I tried calling rte_mempool_count() and it
returned zero.
I inspected the code in dpdk-1.3.1-7 and dpdk.1.4.1-4:
rte_mempool_count(const struct rte_mempool *mp)
{
unsigned count;
count = rte_ring_count(mp->ring);
#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0
{
unsigned lcore_id;
if (mp->cache_size == 0)
return count;
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
count += mp->local_cache[lcore_id].len;
}
#endif
/*
* 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;
}
If I understand it correctly, the ring contains free buffers and
rte_ring_count() returns a number of entries inside a ring. So this
function actually calculates the number of free entries, not busy.
Moreover, rte_mempool_count() is used in many places. For example it's
called in rte_mempool_free_count() and rte_mempool_full().
Can anyone confirm or refute my findings?
Regards,
Dmitry
next reply other threads:[~2013-09-12 7:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 7:52 Dmitry Vyal [this message]
[not found] ` <523172C3.2040309-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-02 13:32 ` Looks like rte_mempool_free_count() and rte_mempool_count() are swapped Thomas Monjalon
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=523172C3.2040309@gmail.com \
--to=dmitryvyal-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.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).