From d15808aa1e8299271e72ed6b89785703df34fb53 Mon Sep 17 00:00:00 2001 From: Intel Date: Wed, 18 Sep 2013 12:00:00 +0200 Subject: [PATCH] mem: retrieve mempool cache only when needed It is an optimization for the single consumer case, or when cache is too small, or when cache is disabled. Signed-off-by: Intel --- lib/librte_mempool/rte_mempool.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index d1f70b8c07..dd8764ae5f 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -654,12 +654,11 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table, unsigned lcore_id = rte_lcore_id(); uint32_t cache_size = mp->cache_size; - cache = &mp->local_cache[lcore_id]; - /* 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_objs = cache->objs; /* Can this be satisfied from the cache? */ -- 2.20.1