DragonFly commits List (threaded) for 2012-10
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: git: kmalloc: Use 'fls' to round up the size to the nearest power of 2
On Tue, Oct 9, 2012 at 12:45 AM, Matthew Dillon
<dillon@apollo.backplane.com> wrote:
> :http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/1e57f8673c953ace8a25ada0a39ab83008646ce3
> :
>
> For cache alignment any allocation that is already a power of 2 will be
> at least that specific power-of-2 aligned. Any allocation that is not
> a power of 2 will be aligned to the slab chunking:
>
> * Alloc Size Chunking Number of zones
> * 0-127 8 16
> * 128-255 16 8
> * 256-511 32 8
> * 512-1023 64 8
> ...
>
> What this means is that in order to cache align an allocation you only
> need to do it for allocations < 256 bytes (if the cache line size is
> 32 bytes). Any allocation >= 256 bytes will be at least 32-byte aligned
> even if it is not a power of 2.
>
> So we don't necessarily need to enforce a power-of-2 size in all cases,
> only in cases where the allocation size < 256 bytes.
Ah, ok, I see. However, I think the cache line size is 64bytes on
x86, so as far as I understand from the above table, allocation >=512
will be at least 64bytes aligned?
Best Regards,
sephe
>
> -Matt
> Matthew Dillon
> <dillon@backplane.com>
--
Tomorrow Will Never Die
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]