git: kmalloc: Use 'fls' to round up the size to the nearest power of 2

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Mon Oct 8 05:26:40 PDT 2012


commit 1e57f8673c953ace8a25ada0a39ab83008646ce3
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Mon Oct 8 20:14:56 2012 +0800

    kmalloc: Use 'fls' to round up the size to the nearest power of 2
    
    On average tests conducted on Intel i3, i7 and xeon-e3 in x86_64 mode,
    fls version is 3 times faster than the simple loop version.
    
    Submitted-by: vsrinivas@
    
    Also M_POWEROF2 flag is used to do the nearest power of 2 size rounding
    up, instead of a seperate function (was kmalloc_powerof2)
    
    Suggested-by: sjg@, vsrinivas@

Summary of changes:
 sys/kern/kern_slaballoc.c                 |   32 +++++++++++++++++++----------
 sys/platform/pc32/i386/busdma_machdep.c   |    3 +-
 sys/platform/pc64/x86_64/busdma_machdep.c |    3 +-
 sys/sys/malloc.h                          |    3 +-
 4 files changed, 26 insertions(+), 15 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/1e57f8673c953ace8a25ada0a39ab83008646ce3


-- 
DragonFly BSD source repository



More information about the Commits mailing list