From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CD28258D6 for ; Thu, 13 Oct 2016 11:39:16 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 13 Oct 2016 02:39:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="772109089" Received: from dpdk4.bj.intel.com ([172.16.182.178]) by FMSMGA003.fm.intel.com with ESMTP; 13 Oct 2016 02:39:15 -0700 From: Wei Dai To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com, jianfeng.tan@intel.com, wei.dai@intel.com Date: Thu, 13 Oct 2016 17:37:25 +0800 Message-Id: <1476351445-18102-1-git-send-email-wei.dai@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2016 09:39:17 -0000 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, -- 2.7.4