From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 742665699 for ; Thu, 13 Oct 2016 13:52:19 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 13 Oct 2016 04:52:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="19250767" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga005.jf.intel.com with ESMTP; 13 Oct 2016 04:52:17 -0700 Received: from pgsmsx109.gar.corp.intel.com (10.221.44.109) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 13 Oct 2016 19:52:16 +0800 Received: from pgsmsx106.gar.corp.intel.com ([169.254.9.133]) by PGSMSX109.gar.corp.intel.com ([169.254.14.146]) with mapi id 14.03.0248.002; Thu, 13 Oct 2016 19:52:16 +0800 From: "Dai, Wei" To: "Ananyev, Konstantin" , "dev@dpdk.org" , "Gonzalez Monroy, Sergio" , "Tan, Jianfeng" Thread-Topic: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages Thread-Index: AQHSJTWxCZjwbi3D/EWr8S5G7Xjzn6ClntyAgAABpoCAAKO6gA== Date: Thu, 13 Oct 2016 11:52:15 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D63A2D3E10@PGSMSX106.gar.corp.intel.com> References: <1476351445-18102-1-git-send-email-wei.dai@intel.com> <2601191342CEEE43887BDE71AB9772583F0C1178@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB9772583F0C11A5@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB9772583F0C11A5@irsmsx105.ger.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzY0OGEzYzktYjlkMC00MGQyLTkzNDctZWM1Yjc0MzgxNDk0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Imp2OHJlNmZyT0wyNlZDalIwWFljeWV0QU9yK2Qyb2FzZVhmSktqaFBcL2dzPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [172.30.20.205] 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 11:52:19 -0000 > > > 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 =3D 0; i < pg_num && mp->populated_size < mp->size; i +=3D n= ) { > > > > > > + 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]? >=20 > Sorry, I meant 'paddr[i + n - 1] + pg_sz =3D=3D paddr[i+n]' off course. >=20 > > Then you don't need extra variable (paddr_next) here. > > Konstantin Thank you, Konstantin 'paddr[i + n - 1] + pg_sz =3D paddr[i + n]' also can fix it and have straig= ht meaning.=20 But I assume that my revision with paddr_next +=3D pg_sz may have a bit bet= ter performance. By the way, paddr[i] + n * pg_sz =3D paddr[i + n] can also resolve it. /Wei > > > > > > > > ret =3D rte_mempool_populate_phys(mp, vaddr + i * pg_sz, > > > -- > > > 2.7.4