kmalloc: Use 'fls' to round up the size to the nearest power of 2
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 8 Oct 2012 12:14:56 +0000 (20:14 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 8 Oct 2012 12:23:49 +0000 (20:23 +0800)
commit1e57f8673c953ace8a25ada0a39ab83008646ce3
tree6171b4b4ea2ee5e1fcd1f4be92874b539cf84b7d
parent16348f3142ec62b5d9ebc02695e606859d8b41f7
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@
sys/kern/kern_slaballoc.c
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc64/x86_64/busdma_machdep.c
sys/sys/malloc.h