Hello guys.
Have you even figured out what is wrong with memalign()?
I tried allocating page-aligned memory and found that it's not
possible, memalign() fails at any size.

-- Jiří Zárevúcky


On 1 September 2011 13:08, Vojtech Horky <[email protected]> wrote:
> Hi Jakub,
> 2011/8/30 Jakub Jermar <[email protected]>:
>> 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.
> I think that the grow_size shall be computed this way (i.e. include
> size of all these structures). But I got lost when pin-pointing what
> alignment is used for each individual structure and around them (e.g.
> for sibling blocks). Without these "extra" alignments, it does not
> work.
>
> I sent the patch rather as a hint where could be some problem than a
> definitive solution because I was not able to get further in finding
> the cause.
>
> - Vojta
>
>>
>> Jakub
>>
>> _______________________________________________
>> HelenOS-devel mailing list
>> [email protected]
>> http://lists.modry.cz/cgi-bin/listinfo/helenos-devel
>>
>
> _______________________________________________
> HelenOS-devel mailing list
> [email protected]
> http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

Reply via email to