[dpdk-dev] [PATCH] parray: introduce internal API for dynamic arrays

Burakov, Anatoly anatoly.burakov at intel.com
Wed Jun 16 14:22:19 CEST 2021


On 16-Jun-21 10:42 AM, Jerin Jacob wrote:
> On Tue, Jun 15, 2021 at 12:18 PM Thomas Monjalon <thomas at monjalon.net> wrote:
>>
>> 14/06/2021 17:48, Morten Brørup:
>>>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
>>> It would be much simpler to just increase RTE_MAX_ETHPORTS to something big enough to hold a sufficiently large array. And possibly add an rte_max_ethports variable to indicate the number of populated entries in the array, for use when iterating over the array.
>>>
>>> Can we come up with another example than RTE_MAX_ETHPORTS where this library provides a better benefit?
>>
>> What is big enough?
>> Is 640KB enough for RAM? ;)
> 
> If I understand it correctly, Linux process allocates 640KB due to
> that fact currently
> struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS] is global and it
> is from BSS.
> 
> If we make this from heap i.e use malloc() to allocate this memory
> then in my understanding Linux
> really won't allocate the real page for backend memory until unless,
> someone write/read to this memory.
> 
> i.e it will be free virtual memory using Linux memory management help.
> If so, we can keep large values for RTE_MAX_ETHPORTS
> without wasting any "real" memory even though the system has a few ports.
> 
> Thoughts?
> 

mmap works this way with anonymous memory, i'm not so sure about 
malloc()'ed memory. Plus, we can't base these decisions on what Linux 
does because we support other OS's. Do they do this as well?

-- 
Thanks,
Anatoly


More information about the dev mailing list