projects
/
dragonfly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
18042a7
)
kmalloc: Use powerof2() to detect power-of-2 size
author
Sepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 10 Oct 2012 12:43:27 +0000 (20:43 +0800)
committer
Sepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 10 Oct 2012 12:43:27 +0000 (20:43 +0800)
sys/kern/kern_slaballoc.c
patch
|
blob
|
blame
|
history
diff --git
a/sys/kern/kern_slaballoc.c
b/sys/kern/kern_slaballoc.c
index
9a80068
..
d23cf8c
100644
(file)
--- a/
sys/kern/kern_slaballoc.c
+++ b/
sys/kern/kern_slaballoc.c
@@
-828,7
+828,7
@@
kmalloc(unsigned long size, struct malloc_type *type, int flags)
* Guarentee power-of-2 alignment for power-of-2-sized chunks.
* Otherwise just 8-byte align the data.
*/
- if ((size | (size - 1)) + 1 == (size << 1))
+ if (powerof2(size))
off = (off + size - 1) & ~(size - 1);
else
off = (off + align - 1) & ~(align - 1);