[dpdk-dev] [PATCH v6 2/3] mempool: use generic memory management
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Sun Jul 5 17:26:19 CEST 2020
On Sun, 5 Jul 2020 16:47:45 +0300, Fady Bader wrote:
> Using generic memory management calls instead of Unix memory management
> calls for mempool.
>
> Signed-off-by: Fady Bader <fady at mellanox.com>
[snip]
> /* populate the mempool with an anonymous mapping */
> @@ -740,20 +741,17 @@ rte_mempool_populate_anon(struct rte_mempool *mp)
> }
>
> /* get chunk of virtually continuous memory */
> - addr = mmap(NULL, size, PROT_READ | PROT_WRITE,
> - MAP_SHARED | MAP_ANONYMOUS, -1, 0);
> - if (addr == MAP_FAILED) {
> - rte_errno = errno;
> + addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
> + RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0);
> + if (addr == NULL)
> return 0;
> - }
> /* can't use MMAP_LOCKED, it does not exist on BSD */
This comment is for removed mmap(), OTOH, it explains why map+lock approach
is used, so perhaps it can be kept.
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
--
Dmitry Kozlyuk
More information about the dev
mailing list