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

Fady Bader fady at mellanox.com
Sun Jul 5 14:25:40 CEST 2020



> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
> Sent: Sunday, July 5, 2020 3:08 PM
> To: Fady Bader <fady at mellanox.com>
> Cc: dev at dpdk.org; Thomas Monjalon <thomas at monjalon.net>; Tasnim Bashar
> <tbashar at mellanox.com>; Tal Shnaiderman <talshn at mellanox.com>; Yohad Tor
> <yohadt at mellanox.com>; harini.ramakrishnan at microsoft.com;
> ocardona at microsoft.com; pallavi.kadam at intel.com; ranjit.menon at intel.com;
> olivier.matz at 6wind.com; arybchenko at solarflare.com; mdr at ashroe.eu;
> nhorman at tuxdriver.com
> Subject: Re: [PATCH v5 2/3] mempool: use generic memory management
> 
> 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.

Ok, I'll send a new version soon.

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