* [dpdk-stable] [PATCH] malloc: respect SIZE_HINT_ONLY when looking for the biggest free elem
@ 2018-10-07 19:31 Darek Stojaczyk
2018-10-08 9:02 ` Burakov, Anatoly
0 siblings, 1 reply; 3+ messages in thread
From: Darek Stojaczyk @ 2018-10-07 19:31 UTC (permalink / raw)
To: dev; +Cc: Darek Stojaczyk, anatoly.burakov, stable
RTE_MEMZONE_SIZE_HINT_ONLY wasn't checked in any way,
causing size hints to be parsed as hard requirements.
This resulted in some allocations being failed prematurely.
Fixes: 68b6092bd3c7 ("malloc: allow reserving biggest element")
Cc: anatoly.burakov@intel.com
Cc: stable@dpdk.org
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
lib/librte_eal/common/malloc_heap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c
index ac7bbb3ba..d2a8bd8dc 100644
--- a/lib/librte_eal/common/malloc_heap.c
+++ b/lib/librte_eal/common/malloc_heap.c
@@ -165,7 +165,9 @@ find_biggest_element(struct malloc_heap *heap, size_t *size,
for (elem = LIST_FIRST(&heap->free_head[idx]);
!!elem; elem = LIST_NEXT(elem, free_list)) {
size_t cur_size;
- if (!check_hugepage_sz(flags, elem->msl->page_sz))
+ if ((flags & RTE_MEMZONE_SIZE_HINT_ONLY) == 0 &&
+ !check_hugepage_sz(flags,
+ elem->msl->page_sz))
continue;
if (contig) {
cur_size =
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH] malloc: respect SIZE_HINT_ONLY when looking for the biggest free elem
2018-10-07 19:31 [dpdk-stable] [PATCH] malloc: respect SIZE_HINT_ONLY when looking for the biggest free elem Darek Stojaczyk
@ 2018-10-08 9:02 ` Burakov, Anatoly
2018-10-28 10:50 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Burakov, Anatoly @ 2018-10-08 9:02 UTC (permalink / raw)
To: Darek Stojaczyk, dev; +Cc: stable
On 07-Oct-18 8:31 PM, Darek Stojaczyk wrote:
> RTE_MEMZONE_SIZE_HINT_ONLY wasn't checked in any way,
> causing size hints to be parsed as hard requirements.
> This resulted in some allocations being failed prematurely.
>
> Fixes: 68b6092bd3c7 ("malloc: allow reserving biggest element")
> Cc: anatoly.burakov@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
> ---
> lib/librte_eal/common/malloc_heap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c
> index ac7bbb3ba..d2a8bd8dc 100644
> --- a/lib/librte_eal/common/malloc_heap.c
> +++ b/lib/librte_eal/common/malloc_heap.c
> @@ -165,7 +165,9 @@ find_biggest_element(struct malloc_heap *heap, size_t *size,
> for (elem = LIST_FIRST(&heap->free_head[idx]);
> !!elem; elem = LIST_NEXT(elem, free_list)) {
> size_t cur_size;
> - if (!check_hugepage_sz(flags, elem->msl->page_sz))
> + if ((flags & RTE_MEMZONE_SIZE_HINT_ONLY) == 0 &&
> + !check_hugepage_sz(flags,
> + elem->msl->page_sz))
> continue;
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Although to be frank, the whole concept of "reserving biggest available
memzone" is currently broken because of dynamic memory allocation. There
is currently no way to allocate "as many hugepages as you can", so we're
only looking at memory already allocated, which in the general case is
less than page size long (unless you use legacy mode or memory
preallocation switches).
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] malloc: respect SIZE_HINT_ONLY when looking for the biggest free elem
2018-10-08 9:02 ` Burakov, Anatoly
@ 2018-10-28 10:50 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-10-28 10:50 UTC (permalink / raw)
To: Darek Stojaczyk; +Cc: dev, Burakov, Anatoly, stable
08/10/2018 11:02, Burakov, Anatoly:
> On 07-Oct-18 8:31 PM, Darek Stojaczyk wrote:
> > RTE_MEMZONE_SIZE_HINT_ONLY wasn't checked in any way,
> > causing size hints to be parsed as hard requirements.
> > This resulted in some allocations being failed prematurely.
> >
> > Fixes: 68b6092bd3c7 ("malloc: allow reserving biggest element")
> > Cc: anatoly.burakov@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
> > ---
> > lib/librte_eal/common/malloc_heap.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c
> > index ac7bbb3ba..d2a8bd8dc 100644
> > --- a/lib/librte_eal/common/malloc_heap.c
> > +++ b/lib/librte_eal/common/malloc_heap.c
> > @@ -165,7 +165,9 @@ find_biggest_element(struct malloc_heap *heap, size_t *size,
> > for (elem = LIST_FIRST(&heap->free_head[idx]);
> > !!elem; elem = LIST_NEXT(elem, free_list)) {
> > size_t cur_size;
> > - if (!check_hugepage_sz(flags, elem->msl->page_sz))
> > + if ((flags & RTE_MEMZONE_SIZE_HINT_ONLY) == 0 &&
> > + !check_hugepage_sz(flags,
> > + elem->msl->page_sz))
> > continue;
>
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
> Although to be frank, the whole concept of "reserving biggest available
> memzone" is currently broken because of dynamic memory allocation. There
> is currently no way to allocate "as many hugepages as you can", so we're
> only looking at memory already allocated, which in the general case is
> less than page size long (unless you use legacy mode or memory
> preallocation switches).
Applied anyway, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-28 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-07 19:31 [dpdk-stable] [PATCH] malloc: respect SIZE_HINT_ONLY when looking for the biggest free elem Darek Stojaczyk
2018-10-08 9:02 ` Burakov, Anatoly
2018-10-28 10:50 ` [dpdk-stable] [dpdk-dev] " 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).