[dpdk-dev] [PATCH v3 03/68] eal: make malloc heap a doubly-linked list

Burakov, Anatoly anatoly.burakov at intel.com
Wed Apr 4 10:05:32 CEST 2018


On 04-Apr-18 12:32 AM, Stephen Hemminger wrote:
> On Wed,  4 Apr 2018 00:21:15 +0100
> Anatoly Burakov <anatoly.burakov at intel.com> wrote:
> 
>> As we are preparing for dynamic memory allocation, we need to be
>> able to handle holes in our malloc heap, hence we're switching to
>> doubly linked list, and prepare infrastructure to support it.
>>
>> Since our heap is now aware where are our first and last elements,
>> there is no longer any need to have a dummy element at the end of
>> each heap, so get rid of that as well. Instead, let insert/remove/
>> join/split operations handle end-of-list conditions automatically.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> 
> Dummy element at end of heap could be helpful for purify/valgrind style verification
> that code does not exceed allocation.
> 

It would interfere with removing pages from memory :) Dummy element 
needs to be stored somewhere - if it's stored in a page, that means that 
page cannot be freed. Moreover, with pages being added/removed 
dynamically, the dummy element will have to be moved back and forth, so 
"at the end of the heap" is not a fixed location.

-- 
Thanks,
Anatoly


More information about the dev mailing list