DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Is ”rte_mempool_mp_put_bulk()“ multi-producer safe?
@ 2013-08-13  6:27 dvr
  2013-08-13 11:47 ` Olivier MATZ
  0 siblings, 1 reply; 2+ messages in thread
From: dvr @ 2013-08-13  6:27 UTC (permalink / raw)
  To: dev

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-13 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13  6:27 [dpdk-dev] Is ”rte_mempool_mp_put_bulk()“ multi-producer safe? dvr
2013-08-13 11:47 ` Olivier MATZ

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).