[dpdk-dev] mem: fix heap size not set on init

Message ID c3967b42840a34adf30af4218dcd5844f0a169b4.1524663338.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov April 25, 2018, 1:42 p.m. UTC
  When heap initializes, we need to add already allocated segments
onto the heap. However, in doing that, we never increased total
heap size. Fix it by adding segment length to total heap length
when initializing the heap.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
Cc: anatoly.burakov@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/common/malloc_heap.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Thomas Monjalon April 30, 2018, 1:37 p.m. UTC | #1
25/04/2018 15:42, Anatoly Burakov:
> When heap initializes, we need to add already allocated segments
> onto the heap. However, in doing that, we never increased total
> heap size. Fix it by adding segment length to total heap length
> when initializing the heap.
> 
> Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
> Cc: anatoly.burakov@intel.com
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c
index 590e9e3..bc96835 100644
--- a/lib/librte_eal/common/malloc_heap.c
+++ b/lib/librte_eal/common/malloc_heap.c
@@ -106,6 +106,8 @@  malloc_add_seg(const struct rte_memseg_list *msl,
 
 	malloc_heap_add_memory(heap, found_msl, ms->addr, len);
 
+	heap->total_size += len;
+
 	RTE_LOG(DEBUG, EAL, "Added %zuM to heap on socket %i\n", len >> 20,
 			msl->socket_id);
 	return 0;