From: Intel Date: Wed, 18 Sep 2013 10:00:00 +0000 (+0200) Subject: mem: retrieve mempool cache only when needed X-Git-Tag: spdx-start~11149 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d15808aa1e8299271e72ed6b89785703df34fb53;p=dpdk.git 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 --- 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? */