mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01:00
lx_emul: natural alignment of power-of-two kmalloc
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user