lkml.org 
[lkml]   [2018]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: lib/genalloc
From
Date


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

\
 
 \ /
  Last update: 2018-11-01 18:08    [W:0.105 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site