DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Memory allocation in dpdk at basic level
@ 2018-10-22 21:08 Avinash Chaurasia
  2018-10-23  9:56 ` Burakov, Anatoly
  0 siblings, 1 reply; 3+ messages in thread
From: Avinash Chaurasia @ 2018-10-22 21:08 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Memory allocation in dpdk at basic level
  2018-10-22 21:08 [dpdk-dev] Memory allocation in dpdk at basic level Avinash Chaurasia
@ 2018-10-23  9:56 ` Burakov, Anatoly
  2018-10-25 10:57   ` Avinash Chaurasia
  0 siblings, 1 reply; 3+ messages in thread
From: Burakov, Anatoly @ 2018-10-23  9:56 UTC (permalink / raw)
  To: Avinash Chaurasia, dev

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] Memory allocation in dpdk at basic level
  2018-10-23  9:56 ` Burakov, Anatoly
@ 2018-10-25 10:57   ` Avinash Chaurasia
  0 siblings, 0 replies; 3+ messages in thread
From: Avinash Chaurasia @ 2018-10-25 10:57 UTC (permalink / raw)
  To: anatoly.burakov; +Cc: dev

Thanks a lot!

Avinash Kumar Chaurasia



On Tue, Oct 23, 2018 at 3:26 PM Burakov, Anatoly <anatoly.burakov@intel.com>
wrote:

> 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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-25 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 21:08 [dpdk-dev] Memory allocation in dpdk at basic level Avinash Chaurasia
2018-10-23  9:56 ` Burakov, Anatoly
2018-10-25 10:57   ` Avinash Chaurasia

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).