[dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages

Ananyev, Konstantin konstantin.ananyev at intel.com
Thu Oct 13 11:59:43 CEST 2016



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ananyev, Konstantin
> Sent: Thursday, October 13, 2016 10:54 AM
> To: Dai, Wei <wei.dai at intel.com>; dev at dpdk.org; Gonzalez Monroy, Sergio <sergio.gonzalez.monroy at intel.com>; Tan, Jianfeng
> <jianfeng.tan at intel.com>; Dai, Wei <wei.dai at intel.com>
> Subject: Re: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages
> 
> Hi
> 
> >
> > Signed-off-by: Wei Dai <wei.dai at intel.com>
> > ---
> >  lib/librte_mempool/rte_mempool.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> > index 71017e1..e3e254a 100644
> > --- a/lib/librte_mempool/rte_mempool.c
> > +++ b/lib/librte_mempool/rte_mempool.c
> > @@ -426,9 +426,12 @@ rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr,
> >
> >  	for (i = 0; i < pg_num && mp->populated_size < mp->size; i += n) {
> >
> > +		phys_addr_t paddr_next;
> > +		paddr_next = paddr[i] + pg_sz;
> > +
> >  		/* populate with the largest group of contiguous pages */
> >  		for (n = 1; (i + n) < pg_num &&
> > -			     paddr[i] + pg_sz == paddr[i+n]; n++)
> > +			     paddr_next == paddr[i+n]; n++, paddr_next += pg_sz)
> >  			;
> 
> Good catch.
> Why not just paddr[i + n - 1] != paddr[i + n]?

Sorry, I meant 'paddr[i + n - 1] + pg_sz == paddr[i+n]' off course.

> Then you don't need extra variable (paddr_next) here.
> Konstantin
> 
> >
> >  		ret = rte_mempool_populate_phys(mp, vaddr + i * pg_sz,
> > --
> > 2.7.4



More information about the dev mailing list