From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2BE5D326C for ; Mon, 9 Jan 2017 11:36:20 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 09 Jan 2017 02:36:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,339,1477983600"; d="scan'208";a="1109937921" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 09 Jan 2017 02:36:19 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.38]) by IRSMSX101.ger.corp.intel.com ([169.254.1.112]) with mapi id 14.03.0248.002; Mon, 9 Jan 2017 10:36:09 +0000 From: "Ananyev, Konstantin" To: Wenfeng Liu , "olivier.matz@6wind.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] mempool: try to get objects from cache when the mempool is single consumer and multiple producer Thread-Index: AQHSamJtLRGcJYVxhE+z5EpTZD+u3aEv8l1A Date: Mon, 9 Jan 2017 10:36:09 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F102895@irsmsx105.ger.corp.intel.com> References: <1483957487-92635-1-git-send-email-liuwf@arraynetworks.com.cn> In-Reply-To: <1483957487-92635-1-git-send-email-liuwf@arraynetworks.com.cn> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] mempool: try to get objects from cache when the mempool is single consumer and multiple producer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2017 10:36:21 -0000 Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenfeng Liu > Sent: Monday, January 9, 2017 10:25 AM > To: olivier.matz@6wind.com > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] mempool: try to get objects from cache when t= he mempool is single consumer and multiple producer >=20 > We put objects to cache when the mempool is multiple producer, however th= e cache will not be used when it is single consumer. > With this patch we can get objects from cache when the single consumer is= happen to be one of the producers, and this improves > performance. >=20 > Signed-off-by: Wenfeng Liu > --- > lib/librte_mempool/rte_mempool.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_me= mpool.h > index d315d42..4ab5a95 100644 > --- a/lib/librte_mempool/rte_mempool.h > +++ b/lib/librte_mempool/rte_mempool.h > @@ -1250,8 +1250,9 @@ __mempool_generic_get(struct rte_mempool *mp, void = **obj_table, > uint32_t index, len; > void **cache_objs; >=20 > - /* No cache provided or single consumer */ > - if (unlikely(cache =3D=3D NULL || flags & MEMPOOL_F_SC_GET || > + /* No cache provided or single consumer and single producer */ > + if (unlikely(cache =3D=3D NULL || > + (flags & MEMPOOL_F_SC_GET) && (flags & MEMPOOL_F_SP_PUT) || I suppose that's a good thing to do... Might be go one step further and don't check flags at all? if (unlikely(cache =3D=3D NULL || n >=3D cache->size) goto ring_dequeue; If people don't want to have a mempool with cache, they can just specify it at mempool creation time. Again cache might improve performance even for SC|SP case. Konstantin =20 > n >=3D cache->size)) > goto ring_dequeue; >=20 > -- > 2.7.4