git: kmalloc: Add kmalloc_powerof2() and kmalloc_cachealign()

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Sat Oct 6 21:42:16 PDT 2012


commit 55126ffeefe32fac458f727ce228b9ea3320ac6a
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Sun Oct 7 12:14:52 2012 +0800

    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.

Summary of changes:
 sys/kern/kern_slaballoc.c |   18 ++++++++++++++++++
 sys/sys/malloc.h          |    4 ++++
 2 files changed, 22 insertions(+), 0 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/55126ffeefe32fac458f727ce228b9ea3320ac6a


-- 
DragonFly BSD source repository



More information about the Commits mailing list