From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 6AA7E2BA9 for ; Thu, 13 Oct 2016 14:31:46 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 13 Oct 2016 05:31:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="889617555" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga003.jf.intel.com with ESMTP; 13 Oct 2016 05:31:44 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.196]) by IRSMSX102.ger.corp.intel.com ([169.254.2.198]) with mapi id 14.03.0248.002; Thu, 13 Oct 2016 13:31:43 +0100 From: "Ananyev, Konstantin" To: "Dai, Wei" , "dev@dpdk.org" , "Gonzalez Monroy, Sergio" , "Tan, Jianfeng" Thread-Topic: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages Thread-Index: AQHSJTXDPD+WrgnpgEuIs8aklR5rf6CmI7QggAACadCAAA8vgIAAGsDA Date: Thu, 13 Oct 2016 12:31:42 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F0C12EF@irsmsx105.ger.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> <49759EB36A64CF4892C1AFEC9231E8D63A2D3E10@PGSMSX106.gar.corp.intel.com> In-Reply-To: <49759EB36A64CF4892C1AFEC9231E8D63A2D3E10@PGSMSX106.gar.corp.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 12:31:46 -0000 >=20 > > > > 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]? > > > > Sorry, I meant 'paddr[i + n - 1] + pg_sz =3D=3D paddr[i+n]' off course. > > > > > Then you don't need extra variable (paddr_next) here. > > > Konstantin >=20 > Thank you, Konstantin > 'paddr[i + n - 1] + pg_sz =3D paddr[i + n]' also can fix it and have stra= ight meaning. > But I assume that my revision with paddr_next +=3D pg_sz may have a bit b= etter performance. I don't think there would be any real difference, again it is not performan= ce critical code-path. > By the way, paddr[i] + n * pg_sz =3D paddr[i + n] can also resolve it. Yes, that's one seems even better for me - make things more clear. Konstantin >=20 > /Wei >=20 > > > > > > > > > > > ret =3D rte_mempool_populate_phys(mp, vaddr + i * pg_sz, > > > > -- > > > > 2.7.4