[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d127f28f-71fe-c175-c0e4-a368ff1d01a1@intel.com>
Date: Thu, 1 Nov 2018 19:08:50 +0200
From: Alexey Skidanov <alexey.skidanov@...el.com>
To: Stephen Bates <sbates@...thlin.com>,
"danielmentz@...gle.com" <danielmentz@...gle.com>,
"mathieu.desnoyers@...icios.co" <mathieu.desnoyers@...icios.co>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Laura Abbott <labbott@...hat.com>
Subject: Re: lib/genalloc
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
Powered by blists - more mailing lists