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
This commit is contained in:
Intel 2013-09-18 12:00:00 +02:00 committed by Thomas Monjalon
parent 7c60fd9ef6
commit d15808aa1e

View File

@ -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? */