DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
To: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
	dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
	Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Subject: [dpdk-dev] [PATCH 0/2] eal/malloc: fix wrong heap initialization over multiple memsegs
Date: Thu,  3 May 2018 15:41:34 +0530	[thread overview]
Message-ID: <cover.1525341819.git.gowrishankar.m@linux.vnet.ibm.com> (raw)

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

When there are multiple memsegs (each per hugepage), there are couple of
problems observed:

  1. Same heap size index is always chosen to add new malloc_elems 
     again and again, while there is an increasing heap size actually.
     Hence, when there is memalloc request for size *more than* 
     elem->size available in free heap, malloc_heap_alloc would fail.
     In elem_start_pt(), we are actually relying on elem->size at the
     best, for finding suitable element, which is lower than requested
     size, in this case.

     Hence, patch 1 in this series addresses this by merging
     contiguous malloc_elem (by virt addresses), so that there is 
     better chance of finding suitable elem for the requested size.
     
  2. Even after resizing the heap malloc_elems, its free_head index
     is still the same, as the memsegs are just added in every malloc_
     elem. If larger memory is requested in rte_malloc, in a way
     that, heap index of requested size is beyond the slot where the
     entire heap is available, malloc_heap_alloc would fail.
     Because, at the time of heap init, only the lower index is
     always chosen to fill up memsegs. Hence, patch 2 addresses this
     by moving the list of malloc_elems into new slot in heap, as its
     size grows.
     
We encountered these situations as we run ip_reassembly example app,
when multiple segments are created in VA (when overcommit hugepages set
in powerpc arch).

These problems are found only in the current releases (until v18.05
which carries new implementation for dynamic memory allocation).
These patches are tested with unit tests as well as some of the 
examples apps. I request more testing if possible, on other archs
as these are problems in available LTS codes as well.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

Gowrishankar Muthukrishnan (2):
  eal/malloc: merge malloc_elems in heap if they are contiguous
  eal/malloc: fix heap index to correctly insert memseg

 lib/librte_eal/common/malloc_heap.c | 52 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

-- 
1.9.1

             reply	other threads:[~2018-05-03 10:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 10:11 Gowrishankar [this message]
2018-05-03 10:11 ` [dpdk-dev] [PATCH 1/2] eal/malloc: merge malloc_elems in heap if they are contiguous Gowrishankar
2018-05-04  9:29   ` Burakov, Anatoly
2018-05-04 10:41     ` gowrishankar muthukrishnan
2018-05-04 11:02       ` Burakov, Anatoly
2018-05-03 10:11 ` [dpdk-dev] [PATCH 2/2] eal/malloc: fix heap index to correctly insert memseg Gowrishankar
2018-05-18 13:10 ` [dpdk-dev] [PATCH 0/2] eal/malloc: fix wrong heap initialization over multiple memsegs Thomas Monjalon
2018-05-19  1:35   ` gowrishankar muthukrishnan

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=cover.1525341819.git.gowrishankar.m@linux.vnet.ibm.com \
    --to=gowrishankar.m@linux.vnet.ibm.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=thomas@monjalon.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).