[dpdk-dev] [PATCH v5 2/3] mempool: use generic memory management

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Sun Jul 5 14:08:26 CEST 2020


On Sun,  5 Jul 2020 14:46:28 +0300, Fady Bader wrote:
[snip]
>  /* populate the mempool with an anonymous mapping */
> @@ -740,20 +741,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_errno is set by rte_mem_map(), using errno here is incorrect on Windows.

>  		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;

Ditto.

[snip]

-- 
Dmitry Kozlyuk


More information about the dev mailing list