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 DFAABA04DD; Tue, 26 Nov 2019 14:40:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F9814C90; Tue, 26 Nov 2019 14:39:59 +0100 (CET) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30079.outbound.protection.outlook.com [40.107.3.79]) by dpdk.org (Postfix) with ESMTP id DFE152B96; Tue, 26 Nov 2019 14:39:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMq2WxeJ+bbzDpnG3CC/I22uSkWHmOhrsWIow6Y0qjGoTqOk5o4NKhJ56mA4l0mSShhSXBiexefC72ENn5yVtKlskUncUycwbW03QvvjcF6fv3boAuDEuKeNVFMbkyPuVULwjSJWAHL59u9N3flxEC/lJ+HNDzZ9QBEdjps3+BexRqAlV7l8qLwWt0OwTlKmeGc06nORQN1jwoAvnMRdfjKygUlkVGDQEzUeQ8MM+qnsT+2dKKKp6KpI/kpiq2GVe5OM3gB8SmB2z3ZWwN9k5Fu1mhCwmLMozVgmFgEqZLwsIUz9s6F/1/ZPGqKpgfHzrhMimTZyWZFUWJjZnO/fWg== 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=ph31H4wxPtNNWMfWJD9SvfUzfvajD0DtSiIT3vxXs4A=; b=Yoknd0NA3xNO96N05FiF90VxbbsI++6keNi9y5uMUlBprA6aA10s7o7w97kTYL2sYEBgOFwvULt+RDPReet9gnvLereaqC/mAr/AI8Nd1QNArTuWbOmfrK7klyscOgou2sKLHpY1kCwnwJ+qdRNnFqPbJzORWIAq9ad1BSB74k1x62CCAXYCJXr3RkGzhFWrllePO9+7rT4cRw6AqBvWKy5SO3DhrYUpnSYfZraSC88mzGoKx8SMVxACv4hZm6SLZRS518s+uDiayMTIAlKVEag1WiG5848lVLIuY6+Ty5x+d9y+M/GPGJ+PQXqgotwOPY2Py7QmbukNW0Pzj/USJw== 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=ph31H4wxPtNNWMfWJD9SvfUzfvajD0DtSiIT3vxXs4A=; b=l6YHChoCUHxIue7O7nKy+UW5ZNCrZd1pWzBGw/oduYGb44rBL2hqP+orsWL+lotXFduvDrLROVWEhGiKhOpG5CPcA4IWHYoqk4bpnJvZl1bfBXWyF0ugctqH4SRGoW0kSybvNR9OlHw72IKSSfWxxNy2MJbZfj3YQ8W91eIQzXM= Received: from DB6PR05MB3190.eurprd05.prod.outlook.com (10.175.233.17) by DB6PR05MB4759.eurprd05.prod.outlook.com (10.168.21.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.21; Tue, 26 Nov 2019 13:39:58 +0000 Received: from DB6PR05MB3190.eurprd05.prod.outlook.com ([fe80::ec63:86f0:7935:bff9]) by DB6PR05MB3190.eurprd05.prod.outlook.com ([fe80::ec63:86f0:7935:bff9%6]) with mapi id 15.20.2474.023; Tue, 26 Nov 2019 13:39:57 +0000 From: "Xueming(Steven) Li" To: Thomas Monjalon , "Burakov, Anatoly" CC: "dev@dpdk.org" , Asaf Penso , "stable@dpdk.org" , "david.marchand@redhat.com" Thread-Topic: [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding Thread-Index: AQHVoHd/sM1kUe/Xp06b4JOY9LWc66eVu7cAgAbSbwCAAOMlgIAACQ0AgAACQ/A= Date: Tue, 26 Nov 2019 13:39:57 +0000 Message-ID: References: <1574346302-1263-1-git-send-email-xuemingl@mellanox.com> <1911864.xaV5BFYatv@xps> <1842633.FO3dX0cGTE@xps> In-Reply-To: <1842633.FO3dX0cGTE@xps> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=xuemingl@mellanox.com; x-originating-ip: [180.162.54.152] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b3f1586e-a948-42ee-ce9d-08d7727620de x-ms-traffictypediagnostic: DB6PR05MB4759:|DB6PR05MB4759: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 0233768B38 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(376002)(396003)(366004)(13464003)(189003)(199004)(6116002)(25786009)(5660300002)(229853002)(81166006)(7696005)(3846002)(478600001)(81156014)(71190400001)(8676002)(99286004)(55016002)(8936002)(53546011)(6506007)(86362001)(74316002)(66946007)(76116006)(66446008)(6246003)(2906002)(4326008)(66556008)(6436002)(102836004)(71200400001)(11346002)(54906003)(14454004)(76176011)(110136005)(316002)(9686003)(52536014)(186003)(33656002)(7736002)(256004)(305945005)(66066001)(446003)(14444005)(26005)(64756008)(66476007); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB4759; H:DB6PR05MB3190.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: nMiUbo8VPpTcoOHnRC7xxpu5uM5g9efn/XRSibKAchNl/1RmKtQ5jcKQdsjYE7VmCzt8WP71VRvvl2uNQA3PpP8lluj1MLDcZYR/qedUknCyq+1L/CzQrBvrH+IP8xivmB0ryEeghNEZJsP+pNx5LuRU6uyTbzzqjm16dTH21es1f2gswjPeJQbyPQGb+prmNpGlvcwOzThFnoV6d9dJaBCZIyki94Fc7pnorOhYVUfzEaalZjhZwPqo+RpXa1neiuOs4IcfUUR03ZeOtH2NhQMZBTEQ0qEPWo8yCxN4a3Q055ZjZ/rs754MbCm2IMIpcfwgQX3CKUCZPVoj0NCH+YfpQqP2jvTa+6yNu4tnzO/AEOCgKFEC7/WL1FQZj8NDXenSaWnLjKo93eWY8+cz58iYPIaHsjjJ2xdbqZc8nUbaRdc9kc7wYgzQ2/ADDwxc 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: b3f1586e-a948-42ee-ce9d-08d7727620de X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2019 13:39:57.7665 (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: CdGwgrZKOFeeDmv/Lz8QJ7FMTyLmkxbiuyUwuYLy3VbjY7ipztM61HZN4uR+wplA48xQEAdjUCMPgKAEpBsHcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB4759 Subject: Re: [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 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: Thomas Monjalon > Sent: Tuesday, November 26, 2019 9:30 PM > To: Burakov, Anatoly > Cc: Xueming(Steven) Li ; dev@dpdk.org; Asaf > Penso ; stable@dpdk.org; > david.marchand@redhat.com > Subject: Re: [dpdk-dev] [PATCH] malloc: fix memory element size in case o= f > padding >=20 > 26/11/2019 13:57, Burakov, Anatoly: > > On 25-Nov-19 11:24 PM, Thomas Monjalon wrote: > > > 21/11/2019 16:14, Burakov, Anatoly: > > >> On 21-Nov-19 2:25 PM, Xueming Li wrote: > > >>> This patch fixes wrong inner memory element size when joining two > > >>> elements. > > >>> > > >>> Fixes: af75078fece3 ("first public release") > > >>> Cc: stable@dpdk.org > > >>> > > >>> Signed-off-by: Xueming Li > > >>> --- > > >>> --- a/lib/librte_eal/common/malloc_elem.c > > >>> +++ b/lib/librte_eal/common/malloc_elem.c > > >>> @@ -487,6 +487,10 @@ join_elem(struct malloc_elem *elem1, struct > malloc_elem *elem2) > > >>> else > > >>> elem1->heap->last =3D elem1; > > >>> elem1->next =3D next; > > >>> + if (elem1->pad) { > > >>> + struct malloc_elem *inner =3D RTE_PTR_ADD(elem1, elem1- > >pad); > > >>> + inner->size =3D elem1->size - elem1->pad; > > >>> + } > > >>> } > > >> > > >> Reviewed-by: Anatoly Burakov > > > > > > I don't understand this patch. > > > The variable inner is never used. > > > What am I missing? > > > > > > > For padded elements, malloc element has two headers - the "outer" > > header with empty space after it, and the "inner" header, after which > > the user memory actually starts. This makes it so that, when joining > > elements, if the outer element had a pad, we also update the inner > element size to match. >=20 > Where the variable "inner" is used in this function? >=20 Rte_realloc, inner size is used to copy data.