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 1AABCA04DD for ; Tue, 26 Nov 2019 15:55:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E109254AE; Tue, 26 Nov 2019 15:55:49 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6F5EDA3; Tue, 26 Nov 2019 15:55:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2019 06:55:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,246,1571727600"; d="scan'208";a="233770608" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.92]) ([10.237.220.92]) by fmsmga004.fm.intel.com with ESMTP; 26 Nov 2019 06:55:44 -0800 To: Thomas Monjalon , "Xueming(Steven) Li" Cc: "dev@dpdk.org" , Asaf Penso , "stable@dpdk.org" , "david.marchand@redhat.com" References: <1574346302-1263-1-git-send-email-xuemingl@mellanox.com> <1842633.FO3dX0cGTE@xps> <4234059.lpkmD0fh1P@xps> From: "Burakov, Anatoly" Message-ID: <4761c048-c7f2-0a35-b464-ae9746e095a0@intel.com> Date: Tue, 26 Nov 2019 14:55:43 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <4234059.lpkmD0fh1P@xps> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 26-Nov-19 1:45 PM, Thomas Monjalon wrote: > 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? Right on the next line after it is created :) -- Thanks, Anatoly