[dpdk-dev] [PATCH v2 2/4] mempool: use generic memory management
Ranjit Menon
ranjit.menon at intel.com
Mon Jun 1 22:47:04 CEST 2020
On 6/1/2020 12:59 PM, Dmitry Kozlyuk wrote:
> 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.
I fully support this.
ranjit m.
More information about the dev
mailing list