From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 49F776CC3 for ; Thu, 13 Oct 2016 11:53:52 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 13 Oct 2016 02:53:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="19604727" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga004.jf.intel.com with ESMTP; 13 Oct 2016 02:53:50 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.196]) by IRSMSX106.ger.corp.intel.com ([169.254.8.209]) with mapi id 14.03.0248.002; Thu, 13 Oct 2016 10:53:49 +0100 From: "Ananyev, Konstantin" To: "Dai, Wei" , "dev@dpdk.org" , "Gonzalez Monroy, Sergio" , "Tan, Jianfeng" , "Dai, Wei" Thread-Topic: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages Thread-Index: AQHSJTXDPD+WrgnpgEuIs8aklR5rf6CmI7Qg Date: Thu, 13 Oct 2016 09:53:49 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F0C1178@irsmsx105.ger.corp.intel.com> References: <1476351445-18102-1-git-send-email-wei.dai@intel.com> In-Reply-To: <1476351445-18102-1-git-send-email-wei.dai@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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:53:52 -0000 Hi=20 >=20 > Signed-off-by: Wei Dai > --- > lib/librte_mempool/rte_mempool.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_me= mpool.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, >=20 > for (i =3D 0; i < pg_num && mp->populated_size < mp->size; i +=3D n) { >=20 > + phys_addr_t paddr_next; > + paddr_next =3D paddr[i] + pg_sz; > + > /* populate with the largest group of contiguous pages */ > for (n =3D 1; (i + n) < pg_num && > - paddr[i] + pg_sz =3D=3D paddr[i+n]; n++) > + paddr_next =3D=3D paddr[i+n]; n++, paddr_next +=3D pg_sz) > ; Good catch. Why not just paddr[i + n - 1] !=3D paddr[i + n]? Then you don't need extra variable (paddr_next) here. Konstantin >=20 > ret =3D rte_mempool_populate_phys(mp, vaddr + i * pg_sz, > -- > 2.7.4