[dpdk-dev] [PATCH v2] mempool: fix alignment of memzone length when populating

Andrew Rybchenko arybchenko at solarflare.com
Mon May 7 10:30:57 CEST 2018


On 05/07/2018 11:18 AM, Olivier Matz wrote:
> When populating a mempool with the default function, if there is not
> enough virtually contiguous memory for the whole mempool, it will be
> populated with several chunks. A chunk of the maximum available length
> is requested with:
>
>    mz = rte_memzone_reserve_aligned(..., len=0, ..., align=x)
>
> If align is smaller than the page size, the address and the length of
> the memzone may not be a multiple of the page size. This makes
> rte_mempool_populate_virt() to fail because it requires them to be
> page-aligned. This patch fixes that.
>
> The problem can be reproduced easily by allocating more than available
> memory:
>    ./build/app/testpmd -l 0,1 -- --total-num-mbufs=65536
>    ...
>    Cause: Creation of mbuf pool for socket 0 failed: Invalid argument
>
> After the patch, the error code is correct:
>    ./build/app/testpmd -l 0,1 -- --total-num-mbufs=65536
>    ...
>    Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate memory
>
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> Fixes: ba0009560c30 ("mempool: support new allocation methods")
> Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko at solarflare.com>


More information about the dev mailing list