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

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


From: Sepherosa Ziehau <sephe@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 8 Oct 2012 05:26:40 -0700 (PDT)

commit 1e57f8673c953ace8a25ada0a39ab83008646ce3
Author: Sepherosa Ziehau <sephe@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



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