From: dvr <jinxiu.1006@163.com>
To: dev@dpdk.org
Subject: [dpdk-dev] Is ”rte_mempool_mp_put_bulk()“ multi-producer safe?
Date: Tue, 13 Aug 2013 14:27:11 +0800 (CST) [thread overview]
Message-ID: <48188b20.1c74c.140765b52ce.Coremail.jinxiu.1006@163.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]
hi,
all
I'm confused with some code about mempool:
rte_mempool.h ( lib/ librte_mempool ,about line 668)
rte_mempool_mp_put_bulk(); //put serveral objects back in the mempool(multi-producers safe)
rte_mempool_sp_put_bulk(); //put serveral objects back in the mempool(NOT multi-producers safe)
rte_mempool.h ( lib/ librte_mempool ,about line 563)
__mempool_put_bulk()
{
......
if(unlikely(cache_size==0 || is_mp==0))
goto ring_enqueue;
......
//add in cache while there is enough room
while(cache_add_count>0) {
cache_objs[cache_len]=*obj_table;
obj_table++;
cache_len++;
n--;
cache_add_count--;
}
......
ring_enqueue:
......
if(is_mp)
rte_ring_mp_enqueue_bulk();
else
rte_ring_sp_enqueue_bulk();
......
}
My question is :rte_mempool_mp_put_bulk() and rte_mempool_sp_put_bulk() call the same function __mempool_put_bulk() with different "is_mp" value. If is_mp=1, that is ,multi-producer, the code will add these objects in cache while there is enough room, when two thread enqueue objects at the same time, isn't it unsafe?but the annotation show this function is "multi-producer safe".
Another question: how many thread we can have on a core? just one?
Any help will be appreciate!
Regards
Maria
[-- Attachment #2: Type: text/html, Size: 3691 bytes --]
next reply other threads:[~2013-08-13 6:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 6:27 dvr [this message]
2013-08-13 11:47 ` Olivier MATZ
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=48188b20.1c74c.140765b52ce.Coremail.jinxiu.1006@163.com \
--to=jinxiu.1006@163.com \
--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).