* [dpdk-stable] [PATCH] malloc: fix memory element size in case of padding @ 2019-11-21 14:25 Xueming Li 2019-11-21 15:14 ` Burakov, Anatoly 0 siblings, 1 reply; 10+ messages in thread From: Xueming Li @ 2019-11-21 14:25 UTC (permalink / raw) To: Anatoly Burakov; +Cc: Xueming Li, Asaf Penso, dev, stable 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> --- lib/librte_eal/common/malloc_elem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index afacb1813c..885d00424b 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 = elem1->size - elem1->pad; + } } struct malloc_elem * -- 2.17.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [PATCH] malloc: fix memory element size in case of padding 2019-11-21 14:25 [dpdk-stable] [PATCH] malloc: fix memory element size in case of padding Xueming Li @ 2019-11-21 15:14 ` Burakov, Anatoly 2019-11-25 23:24 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon 2019-11-26 15:26 ` Thomas Monjalon 0 siblings, 2 replies; 10+ messages in thread From: Burakov, Anatoly @ 2019-11-21 15:14 UTC (permalink / raw) To: Xueming Li; +Cc: Asaf Penso, dev, stable 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> > --- > lib/librte_eal/common/malloc_elem.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c > index afacb1813c..885d00424b 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 = elem1->size - elem1->pad; > + } > } > > struct malloc_elem * > Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com> -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-21 15:14 ` Burakov, Anatoly @ 2019-11-25 23:24 ` Thomas Monjalon 2019-11-26 12:57 ` Burakov, Anatoly 2019-11-26 15:26 ` Thomas Monjalon 1 sibling, 1 reply; 10+ messages in thread From: Thomas Monjalon @ 2019-11-25 23:24 UTC (permalink / raw) To: Burakov, Anatoly, Xueming Li; +Cc: dev, Asaf Penso, stable, david.marchand 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? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-25 23:24 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon @ 2019-11-26 12:57 ` Burakov, Anatoly 2019-11-26 13:30 ` Thomas Monjalon 0 siblings, 1 reply; 10+ messages in thread From: Burakov, Anatoly @ 2019-11-26 12:57 UTC (permalink / raw) To: Thomas Monjalon, Xueming Li; +Cc: dev, Asaf Penso, stable, david.marchand 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. -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-26 12:57 ` Burakov, Anatoly @ 2019-11-26 13:30 ` Thomas Monjalon 2019-11-26 13:39 ` Xueming(Steven) Li 0 siblings, 1 reply; 10+ messages in thread From: Thomas Monjalon @ 2019-11-26 13:30 UTC (permalink / raw) To: Burakov, Anatoly; +Cc: Xueming Li, dev, Asaf Penso, stable, david.marchand 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? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-26 13:30 ` Thomas Monjalon @ 2019-11-26 13:39 ` Xueming(Steven) Li 2019-11-26 13:45 ` Thomas Monjalon 0 siblings, 1 reply; 10+ messages in thread From: Xueming(Steven) Li @ 2019-11-26 13:39 UTC (permalink / raw) To: Thomas Monjalon, Burakov, Anatoly; +Cc: dev, Asaf Penso, stable, david.marchand > -----Original Message----- > From: Thomas Monjalon <thomas@monjalon.net> > Sent: Tuesday, November 26, 2019 9:30 PM > To: Burakov, Anatoly <anatoly.burakov@intel.com> > Cc: Xueming(Steven) Li <xuemingl@mellanox.com>; dev@dpdk.org; Asaf > Penso <asafp@mellanox.com>; 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 <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? > Rte_realloc, inner size is used to copy data. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-26 13:39 ` Xueming(Steven) Li @ 2019-11-26 13:45 ` Thomas Monjalon 2019-11-26 14:55 ` Burakov, Anatoly 2019-11-26 15:01 ` Thomas Monjalon 0 siblings, 2 replies; 10+ messages in thread From: Thomas Monjalon @ 2019-11-26 13:45 UTC (permalink / raw) To: Xueming(Steven) Li Cc: Burakov, Anatoly, dev, Asaf Penso, stable, david.marchand 26/11/2019 14:39, Xueming(Steven) Li: > > > -----Original Message----- > > From: Thomas Monjalon <thomas@monjalon.net> > > Sent: Tuesday, November 26, 2019 9:30 PM > > To: Burakov, Anatoly <anatoly.burakov@intel.com> > > Cc: Xueming(Steven) Li <xuemingl@mellanox.com>; dev@dpdk.org; Asaf > > Penso <asafp@mellanox.com>; 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 <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? > > > 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-26 13:45 ` Thomas Monjalon @ 2019-11-26 14:55 ` Burakov, Anatoly 2019-11-26 15:01 ` Thomas Monjalon 1 sibling, 0 replies; 10+ messages in thread From: Burakov, Anatoly @ 2019-11-26 14:55 UTC (permalink / raw) To: Thomas Monjalon, Xueming(Steven) Li Cc: dev, Asaf Penso, stable, david.marchand On 26-Nov-19 1:45 PM, Thomas Monjalon wrote: > 26/11/2019 14:39, Xueming(Steven) Li: >> >>> -----Original Message----- >>> From: Thomas Monjalon <thomas@monjalon.net> >>> Sent: Tuesday, November 26, 2019 9:30 PM >>> To: Burakov, Anatoly <anatoly.burakov@intel.com> >>> Cc: Xueming(Steven) Li <xuemingl@mellanox.com>; dev@dpdk.org; Asaf >>> Penso <asafp@mellanox.com>; 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 <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? Right on the next line after it is created :) -- Thanks, Anatoly ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-26 13:45 ` Thomas Monjalon 2019-11-26 14:55 ` Burakov, Anatoly @ 2019-11-26 15:01 ` Thomas Monjalon 1 sibling, 0 replies; 10+ messages in thread From: Thomas Monjalon @ 2019-11-26 15:01 UTC (permalink / raw) To: Xueming(Steven) Li, Burakov, Anatoly Cc: dev, Asaf Penso, stable, david.marchand 26/11/2019 14:45, Thomas Monjalon: > 26/11/2019 14:39, Xueming(Steven) Li: > > > > > -----Original Message----- > > > From: Thomas Monjalon <thomas@monjalon.net> > > > Sent: Tuesday, November 26, 2019 9:30 PM > > > To: Burakov, Anatoly <anatoly.burakov@intel.com> > > > Cc: Xueming(Steven) Li <xuemingl@mellanox.com>; dev@dpdk.org; Asaf > > > Penso <asafp@mellanox.com>; 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 <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? > > > > > 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: fix memory element size in case of padding 2019-11-21 15:14 ` Burakov, Anatoly 2019-11-25 23:24 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon @ 2019-11-26 15:26 ` Thomas Monjalon 1 sibling, 0 replies; 10+ messages in thread From: Thomas Monjalon @ 2019-11-26 15:26 UTC (permalink / raw) To: Xueming Li; +Cc: dev, Burakov, Anatoly, Asaf Penso, stable 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> > > Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com> Applied, thanks ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-11-26 15:26 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-21 14:25 [dpdk-stable] [PATCH] malloc: fix memory element size in case of padding Xueming Li 2019-11-21 15:14 ` Burakov, Anatoly 2019-11-25 23:24 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon 2019-11-26 12:57 ` Burakov, Anatoly 2019-11-26 13:30 ` Thomas Monjalon 2019-11-26 13:39 ` Xueming(Steven) Li 2019-11-26 13:45 ` Thomas Monjalon 2019-11-26 14:55 ` Burakov, Anatoly 2019-11-26 15:01 ` Thomas Monjalon 2019-11-26 15:26 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).