mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
lx_emul: natural alignment of power-of-two kmalloc
This commit is contained in:
parent
62492f3cd2
commit
e337f2cb0f
@ -46,6 +46,9 @@ void * __kmalloc(size_t size, gfp_t flags)
|
||||
/* for page-rounded sizes use page-alignment */
|
||||
if ((size % PAGE_SIZE) == 0) align = PAGE_SIZE;
|
||||
|
||||
/* guarantee natural alignment for power-of-two kmalloc (see mm/slab_common.c) */
|
||||
if (is_power_of_2(size)) align = max_t(unsigned long, align, size);
|
||||
|
||||
return lx_emul_mem_alloc_aligned(size, align);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user