From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v2] mempool: replace c memcpy code semantics with optimized rte_memcpy Date: Tue, 31 May 2016 18:28:42 +0530 Message-ID: <20160531125822.GA10995@localhost.localdomain> References: <1464101442-10501-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464250025-9191-1-git-send-email-jerin.jacob@caviumnetworks.com> <574BFD97.2010505@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: , , , To: Olivier Matz Return-path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0083.outbound.protection.outlook.com [157.56.110.83]) by dpdk.org (Postfix) with ESMTP id CCDBB37A6 for ; Tue, 31 May 2016 14:59:05 +0200 (CEST) Content-Disposition: inline In-Reply-To: <574BFD97.2010505@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, May 30, 2016 at 10:45:11AM +0200, Olivier Matz wrote: > Hi Jerin, > > On 05/26/2016 10:07 AM, Jerin Jacob wrote: > > Signed-off-by: Jerin Jacob > > --- > > v1..v2 > > Corrected the the git commit message(s/mbuf/mempool/g) > > --- > > lib/librte_mempool/rte_mempool.h | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h > > index 60339bd..24876a2 100644 > > --- a/lib/librte_mempool/rte_mempool.h > > +++ b/lib/librte_mempool/rte_mempool.h > > @@ -73,6 +73,7 @@ > > #include > > #include > > #include > > +#include > > > > #ifdef __cplusplus > > extern "C" { > > @@ -739,7 +740,6 @@ __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table, > > unsigned n, int is_mp) > > { > > struct rte_mempool_cache *cache; > > - uint32_t index; > > void **cache_objs; > > unsigned lcore_id = rte_lcore_id(); > > uint32_t cache_size = mp->cache_size; > > @@ -768,8 +768,7 @@ __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table, > > */ > > > > /* Add elements back into the cache */ > > - for (index = 0; index < n; ++index, obj_table++) > > - cache_objs[index] = *obj_table; > > + rte_memcpy(&cache_objs[0], obj_table, sizeof(void *) * n); > > > > cache->len += n; > > > > > > I also checked in the get_bulk() function, which looks like that: > > /* Now fill in the response ... */ > for (index = 0, len = cache->len - 1; > index < n; > ++index, len--, obj_table++) > *obj_table = cache_objs[len]; > > I think we could replace it by something like: > > rte_memcpy(obj_table, &cache_objs[len - n], sizeof(void *) * n); > > The only difference is that it won't reverse the pointers in the > table, but I don't see any problem with that. > > What do you think? In true sense, it will _not_ be LIFO. Not sure about cache usage implications on the specific use cases. Jerin > > > Regards, > Olivier >