8ff099ae | 30-Apr-2009 |
Matthew Dillon <dillon@apollo.backplane.com> |
nmalloc - Further optimize posix_memalign()
Align the requested size to the nearest alignment to improve our chances of coming up with a power-of-2.
Greatly improve the fitting algorithm for oddly
nmalloc - Further optimize posix_memalign()
Align the requested size to the nearest alignment to improve our chances of coming up with a power-of-2.
Greatly improve the fitting algorithm for oddly sized requests, e.g.
(1) 32 byte alignment on a 1026 size. In this case the zone for 1026 already has a chunking (128) that exceeds the requested alignment, so we just do a _slaballoc().
(2) A 256 byte alignment on a 513 byte size. In this case the zone for 513 has a chunking of 64, which is not sufficient, so we find the nearest power-of-2 >= 513 and allocate that. In our case we would find 1024. Since _slaballoc() guarantees that power-of-2 allocations within the zone limit will be on the same-sized boundary, we then just allocate the nearest power of 2.
show more ...
|