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 1DBB9A04DD; Tue, 26 Nov 2019 16:01:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78FD43195; Tue, 26 Nov 2019 16:01:50 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 7A56F2B88; Tue, 26 Nov 2019 16:01:49 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8877F227D5; Tue, 26 Nov 2019 10:01:48 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 26 Nov 2019 10:01:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=beO00U9YXvRV4+clbJxY8kQl4oBoWPmCOnPvmQLBF68=; b=aI/MOf+s1cfj vO2ZopRWuGw46gl9wCehEWDp7V2A+amWkBLg45ajlHNMLdIQOFynhEcmpmcnGOrt 7yBTVhvPRj0CNlWR8KVZE8yD7m0pxmJIFtqcSTfdCI7CoTzSpNd2Lo+dV+klS52r PUVuslQh5yCs3OmIH+Zf6Mjh71NxKVc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=beO00U9YXvRV4+clbJxY8kQl4oBoWPmCOnPvmQLBF 68=; b=CYaZ8XzTl51elfDY4wnn5yhc6zTta6aKtE/jZcdx/YIeM8emy9GbaCi91 EQuD+N7xei+Sv8PCOSTkh39uyCBbdlPOiEeP6Ls2HMjlyptv+W6VbFraziDt0PzI WiNcIyOYHg87fzz/fEm8n/WgY67Ha71lmVx6M4PECkxjRyMdhwL7iz4v29I0PbaT q+i0NHo+xyqS5wM1u1mHTqTUp1gzD4swHPl+jlKAFQQpaVQNZsthAZHrEX+8/uMO QqJk/DsqB0ZBaoDFtGXGNPNNb6iZeBpeBoKxedZWF9BZywQP7zkDaaCwe9Fq1/o4 2C5Vom53YWGpLDZLPohINy7Lg8gmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeifedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 826503060061; Tue, 26 Nov 2019 10:01:46 -0500 (EST) From: Thomas Monjalon To: "Xueming(Steven) Li" , "Burakov, Anatoly" Cc: dev@dpdk.org, Asaf Penso , "stable@dpdk.org" , "david.marchand@redhat.com" Date: Tue, 26 Nov 2019 16:01:44 +0100 Message-ID: <1812966.GMqqkeOHEp@xps> In-Reply-To: <4234059.lpkmD0fh1P@xps> References: <1574346302-1263-1-git-send-email-xuemingl@mellanox.com> <4234059.lpkmD0fh1P@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 26/11/2019 14:45, Thomas Monjalon: > 26/11/2019 14:39, Xueming(Steven) Li: > > > > > -----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 of > > > padding > > > > > > 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 = elem1; > > > > >>> elem1->next = next; > > > > >>> + if (elem1->pad) { > > > > >>> + struct malloc_elem *inner = RTE_PTR_ADD(elem1, elem1- > > > >pad); > > > > >>> + inner->size = 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. > > > > > > Where the variable "inner" is used in this function? > > > > > Rte_realloc, inner size is used to copy data. > > I still don't get it. Am I missing half of the patch? > Please give explicit line number. OK after a quick chat, I understood my miss: inner is a pointer helping to reach the size field. Sorry for the noise.