* [dpdk-dev] Memory allocation in libraries
@ 2019-10-09 8:13 Morten Brørup
2019-10-09 9:38 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: Morten Brørup @ 2019-10-09 8:13 UTC (permalink / raw)
To: dpdk-dev
Hi all,
I just noticed an inconsistency in the use of memory allocation:
Some libraries allocate their data structures using the rte_memzone library,
e.g. the rte_ring library:
http://code.dpdk.org/dpdk/latest/source/lib/librte_ring/rte_ring.c#L163
And some libraries allocate their data structures using the rte_malloc library,
e.g. the rte_hash library:
http://code.dpdk.org/dpdk/latest/source/lib/librte_hash/rte_cuckoo_hash.c#L273
These are data structures being used in the data plane,
so I would like to know if this was given any deeper thoughts,
and if there are any performance differences.
Med venlig hilsen / kind regards
- Morten Brørup
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] Memory allocation in libraries
2019-10-09 8:13 [dpdk-dev] Memory allocation in libraries Morten Brørup
@ 2019-10-09 9:38 ` Bruce Richardson
2019-10-10 14:20 ` Burakov, Anatoly
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2019-10-09 9:38 UTC (permalink / raw)
To: Morten Brørup; +Cc: dpdk-dev
On Wed, Oct 09, 2019 at 10:13:07AM +0200, Morten Brørup wrote:
> Hi all,
>
> I just noticed an inconsistency in the use of memory allocation:
>
> Some libraries allocate their data structures using the rte_memzone library,
> e.g. the rte_ring library:
> http://code.dpdk.org/dpdk/latest/source/lib/librte_ring/rte_ring.c#L163
>
> And some libraries allocate their data structures using the rte_malloc library,
> e.g. the rte_hash library:
> http://code.dpdk.org/dpdk/latest/source/lib/librte_hash/rte_cuckoo_hash.c#L273
>
>
> These are data structures being used in the data plane,
> so I would like to know if this was given any deeper thoughts,
> and if there are any performance differences.
>
Both memzones and malloc blocks now come from the same memory, so there
should be no performance differences. Both allocation schemes now use
hugepage memory, so at this point it's largely a matter of preference which
is used. Originally, memzones were preferred in DPDK, since malloc did not
allow getting the physical address info, but I believe that is now possible
for both allocation types.
/Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] Memory allocation in libraries
2019-10-09 9:38 ` Bruce Richardson
@ 2019-10-10 14:20 ` Burakov, Anatoly
0 siblings, 0 replies; 3+ messages in thread
From: Burakov, Anatoly @ 2019-10-10 14:20 UTC (permalink / raw)
To: Bruce Richardson, Morten Brørup; +Cc: dpdk-dev
On 09-Oct-19 10:38 AM, Bruce Richardson wrote:
> On Wed, Oct 09, 2019 at 10:13:07AM +0200, Morten Brørup wrote:
>> Hi all,
>>
>> I just noticed an inconsistency in the use of memory allocation:
>>
>> Some libraries allocate their data structures using the rte_memzone library,
>> e.g. the rte_ring library:
>> http://code.dpdk.org/dpdk/latest/source/lib/librte_ring/rte_ring.c#L163
>>
>> And some libraries allocate their data structures using the rte_malloc library,
>> e.g. the rte_hash library:
>> http://code.dpdk.org/dpdk/latest/source/lib/librte_hash/rte_cuckoo_hash.c#L273
>>
>>
>> These are data structures being used in the data plane,
>> so I would like to know if this was given any deeper thoughts,
>> and if there are any performance differences.
>>
> Both memzones and malloc blocks now come from the same memory, so there
> should be no performance differences. Both allocation schemes now use
> hugepage memory, so at this point it's largely a matter of preference which
> is used. Originally, memzones were preferred in DPDK, since malloc did not
> allow getting the physical address info, but I believe that is now possible
> for both allocation types.
>
> /Bruce
>
That is correct, although i would say it's not a "matter of preference"
of which is used, but rather matter of whether the additional features
offered by memzone allocator (lookup by name, alignment, etc.) are needed.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-10 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 8:13 [dpdk-dev] Memory allocation in libraries Morten Brørup
2019-10-09 9:38 ` Bruce Richardson
2019-10-10 14:20 ` Burakov, Anatoly
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).