DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Avinash Chaurasia <avinash.aviank2003@gmail.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] Memory allocation in dpdk at basic level
Date: Tue, 23 Oct 2018 10:56:18 +0100	[thread overview]
Message-ID: <20c86454-227e-1f1e-fd76-84597f6c9154@intel.com> (raw)
In-Reply-To: <CAOcaUXouR6sxjsvGj2SObDmouCwhpzC0-XnKnwb54B3Gyy-keg@mail.gmail.com>

On 22-Oct-18 10:08 PM, Avinash Chaurasia wrote:
> Hello,
> I am not sure whether this is right list for posting this problem. I am
> trying to understand how dpdk allocate memory. I tried digging code to
> understand memory allocation of DPDK. So far I understood that memory is
> allocated from a heap that dpdk maintains. However, this heap must be
> allocated at some place. I failed to traceback any function (called from
> heap_alloc()) that calls mmap to allocate memory. Please let me know when
> this heap is created, which function call does that.
> Thanks
> Avinash
> 

Hi Avinash,

Here's a very high level overview.

At initialization, we mmap() anonymous memory regions (eal_memory.c 
contains the code - both for legacy and non-legacy mode). Then, we map 
actual pages into that space either at init (in legacy mode) or as 
needed (in non-legacy mode).

In legacy mode, pages are mapped into anonymous memory straight away 
(see legacy init code in eal_memory.c). For non-legacy, page allocation 
happens in eal_memalloc.c on request from malloc (see malloc_heap.c). In 
both cases, newly allocated pages are added to DPDK heap, and from there 
they can be used by the rest of DPDK using rte_malloc or 
rte_memzone_reserve API's.

-- 
Thanks,
Anatoly

  reply	other threads:[~2018-10-23  9:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 21:08 Avinash Chaurasia
2018-10-23  9:56 ` Burakov, Anatoly [this message]
2018-10-25 10:57   ` Avinash Chaurasia

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=20c86454-227e-1f1e-fd76-84597f6c9154@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=avinash.aviank2003@gmail.com \
    --cc=dev@dpdk.org \
    /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).