On 30 August 2011 23:54, Jakub Jermar <[email protected]> wrote: > On 08/17/2011 05:42 PM, Vojtech Horky wrote: >> + /* >> + * When growing the heap, we need to allocate at least this much >> + * space. >> + * Generally, to allocate x bytes aligned at y, we need at least >> + * space x + y bytes. >> + * Here we add some extra space (through ALIGN_UP(..., BASE_ALIGN)) >> + * just to be on the safe side. >> + * Notice that we need to take care of all structures as growing >> + * the heap might bring a new AS area. >> + */ >> + size_t grow_size = ALIGN_UP(sizeof(heap_area_t), BASE_ALIGN) >> + + ALIGN_UP(sizeof(heap_block_head_t), BASE_ALIGN) >> + + falign >> + + ALIGN_UP(size, BASE_ALIGN) >> + + ALIGN_UP(sizeof(heap_block_foot_t), BASE_ALIGN); > > This extra space makes the whole thing look strange. Either it is needed > and it shouldn't be called 'extra', or it is not needed and it shouldn't > be there at all. >
Here is my attempt at a patch. It's a little bit more complex, because I merged grow with subsequent allocation for sanity checking and to eliminate the unnecessary search. I also only add a necessary amount when resizing an existing area. Seems to work fine for me. -- Jirka Zr.
memalign_jz.patch
Description: Binary data
_______________________________________________ HelenOS-devel mailing list [email protected] http://lists.modry.cz/cgi-bin/listinfo/helenos-devel
