patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Xueming(Steven) Li" <xuemingl@mellanox.com>,
	David Marchand <david.marchand@redhat.com>
Cc: Asaf Penso <asafp@mellanox.com>, dev <dev@dpdk.org>,
	dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded element size
Date: Thu, 21 Nov 2019 13:15:07 +0000
Message-ID: <8e45a13a-1a00-bbc3-f688-dbc8c69878a8@intel.com> (raw)
In-Reply-To: <DB6PR05MB31900F47CBDC816176CE7509AC4E0@DB6PR05MB3190.eurprd05.prod.outlook.com>

On 21-Nov-19 12:55 PM, Xueming(Steven) Li wrote:
> Hi Anatoly,
> 
>> -----Original Message-----
>> From: Burakov, Anatoly <anatoly.burakov@intel.com>
>> Sent: Thursday, November 21, 2019 8:30 PM
>> To: David Marchand <david.marchand@redhat.com>; Xueming(Steven) Li
>> <xuemingl@mellanox.com>
>> Cc: Asaf Penso <asafp@mellanox.com>; dev <dev@dpdk.org>; dpdk stable
>> <stable@dpdk.org>
>> Subject: Re: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded element size
>>
>> On 20-Nov-19 1:25 PM, David Marchand wrote:
>>> On Wed, Nov 20, 2019 at 3:12 AM Xueming(Steven) Li
>>> <xuemingl@mellanox.com> wrote:
>>>>
>>>>> -----Original Message-----
>>>>> From: David Marchand <david.marchand@redhat.com>
>>>>> Sent: Wednesday, November 20, 2019 4:47 AM
>>>>> To: Xueming(Steven) Li <xuemingl@mellanox.com>; Anatoly Burakov
>>>>> <anatoly.burakov@intel.com>
>>>>> Cc: Asaf Penso <asafp@mellanox.com>; dev <dev@dpdk.org>; dpdk stable
>>>>> <stable@dpdk.org>
>>>>> Subject: Re: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded
>>>>> element size
>>>>>
>>>>> On Tue, Nov 12, 2019 at 3:50 PM Xueming Li <xuemingl@mellanox.com>
>>>>> wrote:
>>>>>>
>>>>>> When resize a memory with next element, the original element size grows.
>>>>>> If the orginal element has padding, the real inner element size
>>>>>> didn't grow as well and this causes trailer verification failure
>>>>>> when malloc debug enabled.
>>>>>
>>>>> I did not see this when running the malloc_autotest with debug enabled.
>>>>> What is missing for me to catch it?
>>>>>
>>>> Yes, it happens rarely, depends on memory fragment. I only caught this in
>> middle of a long test.
>>>>
>>>>>
>>>>> Just a bit chilly to apply this series.
>>>>> The first patch seems an optimisation.
>>>>> The second one seems more interesting if we fix the debug mode, but
>>>>> I suppose we can live without them in 19.11.
>>>> Few people enable memory debug option, they are there for years.
>>>
>>> Had a discussion offlist with Anatoly.
>>> Those two issues are hard to catch but the fixes are relevant and
>>> Anatoly is confident.
>>> I will take this in rc3.
>>>
>>> Series applied, thanks.
>>>
>>
>> To test them, i had to modify malloc to always create padded elements :)
> 
> I fix another issue in element join, as I made some local enhancement patch on memory, it's required, not sure whether it help on public code.
> 
> diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c
> index afacb1813c..c3fa0d1039 100644
> --- 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 += elem2->size;
> +       }
>   }
> 
> 

This looks like a good change as well - while we /mostly/ join elements 
when they're free, there is one case where we can join a free element 
with one already occupied - and /that/ element could be padded, which we 
currently don't update. So, this patch would help the public code as well.

> 
>>
>> --
>> Thanks,
>> Anatoly


-- 
Thanks,
Anatoly

  reply	other threads:[~2019-11-21 13:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 14:50 [dpdk-stable] [PATCH 1/2] malloc: fix realloc wrong copy size Xueming Li
2019-11-12 14:50 ` [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded element size Xueming Li
2019-11-14 15:11   ` Burakov, Anatoly
2019-11-19 20:47   ` David Marchand
2019-11-20  2:12     ` Xueming(Steven) Li
2019-11-20 13:25       ` David Marchand
2019-11-21 12:30         ` Burakov, Anatoly
2019-11-21 12:55           ` Xueming(Steven) Li
2019-11-21 13:15             ` Burakov, Anatoly [this message]
2019-11-21 13:17               ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-11-21 14:11                 ` Xueming(Steven) Li
2019-11-14 15:11 ` [dpdk-stable] [PATCH 1/2] malloc: fix realloc wrong copy size Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e45a13a-1a00-bbc3-f688-dbc8c69878a8@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=asafp@mellanox.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=xuemingl@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git