From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00ABCA04DD; Sun, 19 Jan 2020 13:29:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F2E5228F3; Sun, 19 Jan 2020 13:29:55 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by dpdk.org (Postfix) with ESMTP id 9DA131B05; Sun, 19 Jan 2020 13:29:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zuu11XJ6I4IEjP8tUp/uGNQFDGx1He4vTh5Q5HDX5iDwNk4YhOn9TNH7nSPFDwFsEn7qwN8y5pXFTeCWBtrvtqWOna2YlP7uva6rMivTJWj7TFqED4x7boMe44fRDAbsDu7v+Ms9M9HpDTaqazmwIW2nNn1WlKwBBXjpgqRE6pkuHWv73BvXJR+9+XrnsXReO5k3L2C62Kx2Hd1Ax2zzSajCvdY+KR4AGtIv/G8oW5l+mTGzTnIIxuW6FsRMorxE1B5CDaD0g6c3ZGEBRh7gLx6HUb7BKm4SDpOcMDBLCkRSXfelsQUqQDerkT0DEip1/X0JVbKx7kGVL5ntHCbsSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wh/XljGbS8kH4M2NHEiifwpdkZf1MQRhGMOiAQL1fbM=; b=mIL3EkGPH1MEZgSZiDofvrcsNgKdBfJ2fG9PDwHnsLBP9wfV2TpB3f83Na3AbiQOUBZia2G2ssCrjmlsVng6ckPHT+ORhpfni7d4/V+SrDjmUGSosxryk5LvTJVEW0k4Vv4hLCz0Hf8/SqZTh769m43p1pTFoaiqr2q3bb05dKnN4NUtEiHSktTix9rom7XsQSUs2uNGwMToQVMwLTUfB5CNMzC3M4FHXWS5XeU4UD8zKRapRQVzdsAY2p44lwlbQZfaHTUIz+JtE4fqjJmEi/5uwML/450w5d0W5jtvHcr78xCTGO+CMFPC4qGSxhHmfzgq9Q0eAHlZx1MDiQf8Gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wh/XljGbS8kH4M2NHEiifwpdkZf1MQRhGMOiAQL1fbM=; b=i6oClQWWil3gH1GPsm8TABRo4KE1AtTO+slypVjWNtbXniRE0FinU5uhzFoEjELOlFuBf272p7SLKmigLcf2tONF+OWKdgbGUSdNjNmRN9xvTd5ouf7YntI+sQV6IraranJ25diHxTg+kJw/FG6xbnoiXe4+UZW9ZkesboLopfE= Received: from AM0PR05MB4401.eurprd05.prod.outlook.com (52.134.124.20) by AM0PR05MB4131.eurprd05.prod.outlook.com (52.134.93.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Sun, 19 Jan 2020 12:29:53 +0000 Received: from AM0PR05MB4401.eurprd05.prod.outlook.com ([fe80::d5e8:d078:e580:ffd7]) by AM0PR05MB4401.eurprd05.prod.outlook.com ([fe80::d5e8:d078:e580:ffd7%6]) with mapi id 15.20.2644.024; Sun, 19 Jan 2020 12:29:53 +0000 From: Ali Alnubani To: Olivier Matz , "dev@dpdk.org" CC: Anatoly Burakov , Andrew Rybchenko , Raslan Darawsheh , "stable@dpdk.org" , Thomas Monjalon Thread-Topic: [PATCH v2] mempool: fix slow allocation of large mempools Thread-Index: AQHVzRvMj4XYjafV/E2JheVYF192I6fx7c9g Date: Sun, 19 Jan 2020 12:29:53 +0000 Message-ID: References: <20200109132742.15828-1-olivier.matz@6wind.com> <20200117095149.23107-1-olivier.matz@6wind.com> In-Reply-To: <20200117095149.23107-1-olivier.matz@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a11c221d-b85f-450d-cad2-08d79cdb493b x-ms-traffictypediagnostic: AM0PR05MB4131:|AM0PR05MB4131: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:785; x-forefront-prvs: 0287BBA78D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(136003)(346002)(39860400002)(366004)(396003)(189003)(199004)(110136005)(71200400001)(186003)(316002)(478600001)(52536014)(54906003)(8936002)(6506007)(53546011)(7696005)(8676002)(81156014)(26005)(33656002)(5660300002)(9686003)(86362001)(4326008)(81166006)(55016002)(66556008)(66476007)(107886003)(66946007)(66446008)(2906002)(76116006)(64756008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4131; H:AM0PR05MB4401.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xhozBJP+88K7jlrjWwP/x7T2Glsuym+AmySV0fnFHs61DfjxxcgglOUnCSCFFAtKnWjDni8+3R7v87ETeS6Th/U5C4ZQ6YJ4x0ElqEJJ/idkgVcKIq8QwvoXVD7O2X3tt34TP3WRZdiu10HYox3gbJ5L73mN+W0La/19v4FAOY4qN4g+z+ED7LLiSZsreZTqC+/YrFK2tTss5oKcSkWkfMB0WWGqEzIECIVMl2zF+fFRgRObK87FhZSaQeGR7yWIGAep1I46pHrpejyCmQQadgvHl5N2l6zZP60D0aacaFy7skRhunaXItJDQld8kgFuBJcQkSsAwwxEXvN/eEoiNpVyzG7Kof+2trNHuZ3q+mnupMVawO91Ie9cUOr58k0u/TTCb//uuWa3y2sQOWRgxCmQUDdC+UR1rHcvtSQ1U90RnkMQcTfQ8livwS3gQ4P/ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a11c221d-b85f-450d-cad2-08d79cdb493b X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2020 12:29:53.5541 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HpX6ZCqYoshV13ADaJL3CudCpx2hfP4VYUIOHkCotWUzMcmgkC40YHHpE+Bhcba2iQrSOWO0HGVpyp18Pvl9OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4131 Subject: Re: [dpdk-dev] [PATCH v2] mempool: fix slow allocation of large mempools X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Olivier Matz > Sent: Friday, January 17, 2020 11:52 AM > To: dev@dpdk.org > Cc: Ali Alnubani ; Anatoly Burakov > ; Andrew Rybchenko > ; Raslan Darawsheh > ; stable@dpdk.org; Thomas Monjalon > > Subject: [PATCH v2] mempool: fix slow allocation of large mempools >=20 > When allocating a mempool which is larger than the largest available area= , it > can take a lot of time: >=20 > a- the mempool calculate the required memory size, and tries > to allocate it, it fails > b- then it tries to allocate the largest available area (this > does not request new huge pages) > c- add this zone to the mempool, this triggers the allocation > of a mem hdr, which request a new huge page > d- back to a- until mempool is populated or until there is no > more memory >=20 > This can take a lot of time to finally fail (several minutes): in step > a- it takes all available hugepages on the system, then release them afte= r it > fails. >=20 > The problem appeared with commit eba11e364614 ("mempool: reduce > wasted space on populate"), because smaller chunks are now allowed. > Previously, it had to be at least one page size, which is not the case in= step b-. >=20 > To fix this, implement our own way to allocate the largest available area > instead of using the feature from memzone: if an allocation fails, try to= divide > the size by 2 and retry. When the requested size falls below min_chunk_si= ze, > stop and return an error. >=20 > Fixes: eba11e364614 ("mempool: reduce wasted space on populate") > Cc: stable@dpdk.org >=20 > Signed-off-by: Olivier Matz > --- >=20 > v2: > * fix missing check on mz =3D=3D NULL condition >=20 Tested-by: Ali Alnubani