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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://dpdk.org/ml/archives/dev/attachments/20130813/f4506517/attachment.html>