On 11/1/18 18:48, Stephen  Bates wrote:
>>    I use gen_pool_first_fit_align() as pool allocation algorithm allocating
>>    buffers with requested alignment. But if a chunk base address is not
>>    aligned to the requested alignment(from some reason), the returned
>>    address is not aligned too.
>     
> Alexey
> 
> Can you try using gen_pool_first_fit_order_align()? Will that give you the 
> alignment you need?
> 
> Stephen
>     
> 
I think it will not help me. Let's assume that the chunk base address is
0x2F400000 and I want to allocate 16MB aligned buffer. I get back the
0x2F400000. I think it happens because of this string in the
gen_pool_alloc_algo():

addr = chunk->start_addr + ((unsigned long)start_bit << order);

and the gen_pool_first_fit_align() implementation that doesn't take into
account the "incorrect" chunk base alignment.

It might be easily fixed, by rounding the start address up (0x2F400000
-> 0x30000000) and start looking from this, aligned, address.

Thanks,
Alexey

Reply via email to