]> git.droids-corp.org - dpdk.git/commit
mempool: reduce wasted space on mempool populate
authorOlivier Matz <olivier.matz@6wind.com>
Mon, 4 Nov 2019 15:12:49 +0000 (16:12 +0100)
committerOlivier Matz <olivier.matz@6wind.com>
Tue, 5 Nov 2019 14:37:06 +0000 (15:37 +0100)
commitd9339d20e14f6cc19fe8cad4df3ab26a7c444772
tree619ae57e481c3ecc68bf481c8e5f6c0dfca7f48e
parentc68fddf7a1879e40ebfe43e9b03e79f40b8619c5
mempool: reduce wasted space on mempool populate

The size returned by rte_mempool_op_calc_mem_size_default() is aligned
to the specified page size. Therefore, with big pages, the returned size
can be much more that what we really need to populate the mempool.

For instance, populating a mempool that requires 1.1GB of memory with
1GB hugepages can result in allocating 2GB of memory.

This problem is hidden most of the time due to the allocation method of
rte_mempool_populate_default(): when try_iova_contig_mempool=true, it
first tries to allocate an iova contiguous area, without the alignment
constraint. If it fails, it fallbacks to an aligned allocation that does
not require to be iova-contiguous. This can also fallback into several
smaller aligned allocations.

This commit changes rte_mempool_op_calc_mem_size_default() to relax the
alignment constraint to a cache line and to return a smaller size.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybdhenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
lib/librte_mempool/rte_mempool.c
lib/librte_mempool/rte_mempool.h
lib/librte_mempool/rte_mempool_ops.c
lib/librte_mempool/rte_mempool_ops_default.c