[dpdk-dev] [PATCH v3 3/5] lib/mempool: allow page size aligned mempool

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu Mar 21 15:00:51 CET 2019



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Xiaolong Ye
> Sent: Thursday, March 21, 2019 9:19 AM
> To: dev at dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang at intel.com>; Karlsson, Magnus <magnus.karlsson at intel.com>; Topel, Bjorn <bjorn.topel at intel.com>; Ye,
> Xiaolong <xiaolong.ye at intel.com>
> Subject: [dpdk-dev] [PATCH v3 3/5] lib/mempool: allow page size aligned mempool
> 
> Allow create a mempool with page size aligned base address.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye at intel.com>
> ---
>  lib/librte_mempool/rte_mempool.c | 3 +++
>  lib/librte_mempool/rte_mempool.h | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index 683b216f9..33ab6a2b4 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -543,6 +543,9 @@ rte_mempool_populate_default(struct rte_mempool *mp)
>  		if (try_contig)
>  			flags |= RTE_MEMZONE_IOVA_CONTIG;
> 
> +		if (mp->flags & MEMPOOL_F_PAGE_ALIGN)
> +			align = getpagesize();
> +

Might be a bit safer:
pg_sz = getpagesize();
align = RTE_MAX(align, pg_sz);

BTW, why do you need it always default page size aligned?
Is it for 'external' memory allocation or even for eal hugepages too?
Konstantin

>  		mz = rte_memzone_reserve_aligned(mz_name, mem_size,
>  				mp->socket_id, flags, align);
> 


More information about the dev mailing list