From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CA264A04DD;
	Tue, 26 Nov 2019 14:30:20 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id ABB765B3E;
	Tue, 26 Nov 2019 14:30:20 +0100 (CET)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com
 [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id AAE744CA6;
 Tue, 26 Nov 2019 14:30:19 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id EE7092267A;
 Tue, 26 Nov 2019 08:30:18 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Tue, 26 Nov 2019 08:30:18 -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=mQkbtOE3ifEm5veKom/HOaZXVZYb0Y/Qn1UrkI0IbIs=; b=OypI3D+YBT8A
 ZrmT7wrasU434PM7FR8JzmiT0hManOfdZPoCOeM5DZ8X09icuXxGu1Ch1AvsTz75
 +GGixndCFfevQBPADypD4mqPD6YJewUu/QXBVaHn9H/CKM5LRCtGlzBeTZbuZS1l
 UMtYGcWGic45Wyc8GGiL/Rn2CPUYUFw=
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=mQkbtOE3ifEm5veKom/HOaZXVZYb0Y/Qn1UrkI0Ib
 Is=; b=pacU2SJ6x5tNMUtVs40v59f1tsu5GgScSDF4/Bk8O+b8yzmbaPbqTpxRq
 WHtNuqWYQSFzUpW5o3vhw/E8OlaIvE7wSprFtrCgEUVLSbStoR/1/D5WutZg+A5S
 NW3h1UMhE1DhLmKmHObC+BRSrGlN4bQxD/0UJzry/V72qodSuaaygyEMGAsWvTwD
 PtiVI5DfLuxUGr6zrKjmaH8Sgwo8FaJvHagR0dMj1D6G9ySEJ5bTStnpsWZk8Xy2
 4JR0UzP703XFjXEhoKU2Kg3w97KGa/1WH3JTNvYNXgpcqpGQYbF9Ryj7eyeY5nfI
 ZGhyr0ePusHKz7LodV6et1t+WhToQ==
X-ME-Sender: <xms:6ijdXQEdvjyd_yi0ENe_B01AjezrXwxSAAAhRYJIj1T8QnOttkWViA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeifedgheegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf
 hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh
 ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy: <xmx:6ijdXZCtpefTO9tcMTOIffHHKGfcxRPE-0_VWf8QC8T29t4gv9TBNA>
 <xmx:6ijdXQH510ojcrrR3apPEb2qz98oWhOSlRJcVZ3MqogvYGLndLR63w>
 <xmx:6ijdXcWnP4p6s_BoKXB3s4oS03obxrapRoEJ6hhO-FjYKVIn7i4kaQ>
 <xmx:6ijdXdfOZ3Zlw4qwFBg4v-6ZIkbioQYU584k0CTsB6E87LS-_sbg4A>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id C52123060065;
 Tue, 26 Nov 2019 08:30:17 -0500 (EST)
From: Thomas Monjalon <thomas@monjalon.net>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: Xueming Li <xuemingl@mellanox.com>, dev@dpdk.org,
 Asaf Penso <asafp@mellanox.com>, stable@dpdk.org, david.marchand@redhat.com
Date: Tue, 26 Nov 2019 14:30:16 +0100
Message-ID: <1842633.FO3dX0cGTE@xps>
In-Reply-To: <d818e52e-0aa0-7cd6-d6ab-6d7ef973c3c4@intel.com>
References: <1574346302-1263-1-git-send-email-xuemingl@mellanox.com>
 <1911864.xaV5BFYatv@xps> <d818e52e-0aa0-7cd6-d6ab-6d7ef973c3c4@intel.com>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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 <xuemingl@mellanox.com>
> >>> ---
> >>> --- 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 <anatoly.burakov@intel.com>
> > 
> > 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?