From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m13-71.163.com (m13-71.163.com [220.181.13.71]) by dpdk.org (Postfix) with ESMTP id 609421F3 for ; Tue, 13 Aug 2013 08:26:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Received:Date:From:To:Subject:Content-Type: MIME-Version:Message-ID; bh=PDw2FBWSAMnY9q5pTDi5vAce5nTMy4GZCfaD sOBBBiM=; b=XSeOaUaS0iyPWiytZEgGWB4SaK2ok36qm3UARRDb7BLHwswSqoS9 H5BRDmTvQFP7vyigWcUnD4w1fEhT0lHFx1rI1MtpQTp67dd0sGvpHa5SIB9tagLZ Ci05Ik8v16N8ISwOh692IZ+ugvZPVOicVOLiuRNz3mjXpfduDI49FDQ= Received: from jinxiu.1006$163.com ( [211.162.75.108] ) by ajax-webmail-wmsvr71 (Coremail) ; Tue, 13 Aug 2013 14:27:11 +0800 (CST) X-Originating-IP: [211.162.75.108] Date: Tue, 13 Aug 2013 14:27:11 +0800 (CST) From: dvr To: dev@dpdk.org X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20130709(22708.5479.5480) Copyright (c) 2002-2013 www.mailtech.cn 163com X-CM-CTRLDATA: AjDJYGZvb3Rlcl9odG09MzYxMDo4MQ== Content-Type: multipart/alternative; boundary="----=_Part_383295_844658498.1376375231182" MIME-Version: 1.0 Message-ID: <48188b20.1c74c.140765b52ce.Coremail.jinxiu.1006@163.com> X-CM-TRANSID: R8GowECJRkDA0QlSypj+AA--.1799W X-CM-SenderInfo: xmlq5xbxoriiqw6rljoofrz/1tbiGgJ47FD+LPVu+wABsv X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Subject: [dpdk-dev] =?gbk?b?SXMgobFydGVfbWVtcG9vbF9tcF9wdXRfYnVsaygpobAg?= =?gbk?q?multi-producer_safe=3F?= X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Aug 2013 06:26:48 -0000 ------=_Part_383295_844658498.1376375231182 Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: 7bit 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 ------=_Part_383295_844658498.1376375231182 Content-Type: text/html; charset=GBK Content-Transfer-Encoding: 7bit
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


------=_Part_383295_844658498.1376375231182--