kmalloc: Add kmalloc_powerof2() and kmalloc_cachealign()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 7 Oct 2012 04:14:52 +0000 (12:14 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 7 Oct 2012 04:14:52 +0000 (12:14 +0800)
commit55126ffeefe32fac458f727ce228b9ea3320ac6a
treecf5ad89bcbb5a5fd4910e770502d99da6e419748
parentff230ec8e08911c0ec9fcd292c2feaab0f7f1241
kmalloc: Add kmalloc_powerof2() and kmalloc_cachealign()

kmalloc_powerof2()
    Ensures that the returned address will be power of 2 aligned.

kmalloc_cachealign()
    Ensures that the returned address will be cacheline size aligned.
    It is useful to allocate structs declared with __cachealign
    attribute.

These two function probably should _not_ be used on the hot code path
due to the computational cost to find the nearest power of 2 size.
sys/kern/kern_slaballoc.c
sys/sys/malloc.h