[dpdk-dev] [PATCH v2 2/4] mempool: use generic memory management
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Mon Jun 1 21:59:21 CEST 2020
On Mon, 1 Jun 2020 13:31:37 +0300
Fady Bader <fady at mellanox.com> wrote:
[snip]
> /* populate the mempool with an anonymous mapping */
> @@ -740,20 +739,20 @@ 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) {
> + addr = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
> + RTE_MAP_SHARED | RTE_MAP_ANONYMOUS, -1, 0);
> + if (addr == NULL) {
> rte_errno = errno;
rte_mem_map() sets rte_errno, on Windows using errno here is invalid.
> return 0;
> }
> /* can't use MMAP_LOCKED, it does not exist on BSD */
> - if (mlock(addr, size) < 0) {
> + if (rte_mem_lock(addr, size) < 0) {
> rte_errno = errno;
Same as above.
[snip]
Two more things:
1. What do you think about changing rte_ to rte_eal_ prefix for memory
management wrappers in MM series as Andrew Rybchenko suggested for v1? Since
the functions are DPDK-internal, this sounds reasonable to me.
2. Please use --in-reply-to for v2 and on.
--
Dmitry Kozlyuk
More information about the dev
mailing list