[dpdk-dev] [RFC v2 00/23] Dynamic memory allocation for DPDK

Burakov, Anatoly anatoly.burakov at intel.com
Thu Jan 25 17:18:43 CET 2018


On 23-Jan-18 10:33 PM, Yongseok Koh wrote:
> 
>> On Dec 19, 2017, at 3:14 AM, Anatoly Burakov <anatoly.burakov at intel.com> wrote:
> [...]
>> Quick outline of all changes done as part of this patchset:
>>
>> * Malloc heap adjusted to handle holes in address space
>> * Single memseg list replaced by multiple expandable memseg lists
>> * VA space for hugepages is preallocated in advance
> 
> Hi Anatoly,
> 
> I haven't looked through your patchset yet but quick question.  As far as I
> understand, currently EAL remaps virtual addresses to make VA layout matches PA
> layout. I'm not sure my expression is 100% correct.
> 
> By your comment above, do you mean VA space for all available physical memory
> will always be contiguous?
> 
> I have been curious about why VA space is fragmented in DPDK.
> 
> Thanks,
> Yongseok
> 
> 

Hi Yongseok,

Yes and no. Currently, VA space is allocated opportunistically - EAL 
tries to allocate VA space to match PA space layout, but due to varying 
page sizes and contiguous segment sizes, it doesn't always turn out that 
way - hence possible VA fragmentation even if underlying PA space may be 
contiguous.

With this patchset, we kind of do it the other way around - we allocate 
contiguous VA space segment per socket, per page size, and then we map 
physical memory into it, without regard for PA layout whatsoever. So, 
assuming all VA space is mapped, VA space is contiguous while PA space 
may or may not be (depending on underlying physical memory layout and if 
you're using IOMMU).

However, since this is hotpluggable (and hot-unpluggable) memory, we can 
have holes in *mapped* VA space, even though *allocated* VA space would 
be contiguous within the boundaries of page size. You can think of it 
this way - we preallocate segments per page size, per socket, so e.g. on 
a machine with 2 sockets and 2MB and 1GB pages enabled, you'll get 4 
contiguous chunks of VA space that is available for mapping. Underlying 
mappings may or may not be contiguous (i.e. mapped segments might become 
fragmented if you allocate/free memory all over the pace), but they will 
reside within the same contiguous chunk of VA space.

Hope that answers your question :)

-- 
Thanks,
Anatoly


More information about the dev mailing list