DragonFly commits List (threaded) for 2009-04
DragonFly BSD
DragonFly commits List (threaded) for 2009-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

DragonFly-2.3.0.840.g8ff09 master lib/libc/stdlib nmalloc.c


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Apr 2009 20:14:40 -0700 (PDT)

commit 8ff099aed96957a9a33da8f0a729263c4bac2bc3
Author: Matthew Dillon <dillon@apollo.backplane.com>
Date:   Wed Apr 29 20:07:07 2009 -0700

    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.

Summary of changes:
 lib/libc/stdlib/nmalloc.c |   44 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 40 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/8ff099aed96957a9a33da8f0a729263c4bac2bc3


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]