From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergio Gonzalez Monroy Subject: Re: [PATCH] mempool: fix search of maximum contiguous pages Date: Thu, 13 Oct 2016 10:46:25 +0100 Message-ID: References: <1476351445-18102-1-git-send-email-wei.dai@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: Wei Dai , dev@dpdk.org, jianfeng.tan@intel.com, Olivier MATZ Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id DB3E16CCC for ; Thu, 13 Oct 2016 11:46:28 +0200 (CEST) In-Reply-To: <1476351445-18102-1-git-send-email-wei.dai@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" +Olivier On 13/10/2016 10:37, Wei Dai wrote: > paddr[i] + pg_sz always points to the start physical address of the > 2nd page after pddr[i], so only up to 2 pages can be combinded to > be used. With this revision, more than 2 pages can be used. > > Fixes: 84121f197187 ("mempool: store memory chunks in a list") > > Signed-off-by: Wei Dai > --- > 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) > ; > > ret = rte_mempool_populate_phys(mp, vaddr + i * pg_sz,