From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C96DB7F58 for ; Thu, 11 Dec 2014 03:05:05 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 10 Dec 2014 18:05:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="427594664" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 10 Dec 2014 17:54:21 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sBB252JF011008; Thu, 11 Dec 2014 10:05:02 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sBB250UD021313; Thu, 11 Dec 2014 10:05:02 +0800 Received: (from cliang18@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sBB250Pf021304; Thu, 11 Dec 2014 10:05:00 +0800 From: Cunming Liang To: dev@dpdk.org Date: Thu, 11 Dec 2014 10:04:45 +0800 Message-Id: <1418263490-21088-3-git-send-email-cunming.liang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1418263490-21088-1-git-send-email-cunming.liang@intel.com> References: <1418263490-21088-1-git-send-email-cunming.liang@intel.com> Subject: [dpdk-dev] [RFC PATCH 2/7] mempool: use linear-tid as mempool cache index 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: Thu, 11 Dec 2014 02:05:07 -0000 Signed-off-by: Cunming Liang --- lib/librte_mempool/rte_mempool.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 3314651..bf4117b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -159,13 +159,13 @@ struct rte_mempool { unsigned private_data_size; /**< Size of private data. */ #if RTE_MEMPOOL_CACHE_MAX_SIZE > 0 - /** Per-lcore local cache. */ - struct rte_mempool_cache local_cache[RTE_MAX_LCORE]; + /** Per-lthread local cache. */ + struct rte_mempool_cache local_cache[RTE_MAX_THREAD]; #endif #ifdef RTE_LIBRTE_MEMPOOL_DEBUG - /** Per-lcore statistics. */ - struct rte_mempool_debug_stats stats[RTE_MAX_LCORE]; + /** Per-lthread statistics. */ + struct rte_mempool_debug_stats stats[RTE_MAX_THREAD]; #endif /* Address translation support, starts from next cache line. */ @@ -199,9 +199,9 @@ struct rte_mempool { */ #ifdef RTE_LIBRTE_MEMPOOL_DEBUG #define __MEMPOOL_STAT_ADD(mp, name, n) do { \ - unsigned __lcore_id = rte_lcore_id(); \ - mp->stats[__lcore_id].name##_objs += n; \ - mp->stats[__lcore_id].name##_bulk += 1; \ + unsigned __thread_id = rte_linear_thread_id(); \ + mp->stats[__thread_id].name##_objs += n; \ + mp->stats[__thread_id].name##_bulk += 1; \ } while(0) #else #define __MEMPOOL_STAT_ADD(mp, name, n) do {} while(0) @@ -758,7 +758,7 @@ __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table, struct rte_mempool_cache *cache; uint32_t index; void **cache_objs; - unsigned lcore_id = rte_lcore_id(); + unsigned tid = rte_linear_thread_id(); uint32_t cache_size = mp->cache_size; uint32_t flushthresh = mp->cache_flushthresh; #endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */ @@ -775,7 +775,7 @@ __mempool_put_bulk(struct rte_mempool *mp, void * const *obj_table, if (unlikely(n > RTE_MEMPOOL_CACHE_MAX_SIZE)) goto ring_enqueue; - cache = &mp->local_cache[lcore_id]; + cache = &mp->local_cache[tid]; cache_objs = &cache->objs[cache->len]; /* @@ -948,14 +948,14 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table, struct rte_mempool_cache *cache; uint32_t index, len; void **cache_objs; - unsigned lcore_id = rte_lcore_id(); + unsigned tid = rte_linear_thread_id(); uint32_t cache_size = mp->cache_size; /* cache is not enabled or single consumer */ if (unlikely(cache_size == 0 || is_mc == 0 || n >= cache_size)) goto ring_dequeue; - cache = &mp->local_cache[lcore_id]; + cache = &mp->local_cache[tid]; cache_objs = cache->objs; /* Can this be satisfied from the cache? */ -- 1.8.1.4