diff options
-rw-r--r-- | include/linux/slab.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index c19f190..d8832c6 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -6,6 +6,7 @@ #include <string.h> #include <linux/kernel.h> +#include <linux/log2.h> #include <linux/page.h> #include <linux/shrinker.h> #include <linux/types.h> @@ -19,7 +20,10 @@ static inline void *kmalloc(size_t size, gfp_t flags) run_shrinkers(); - p = malloc(size); + p = size + ? aligned_alloc(min(rounddown_pow_of_two(size), + PAGE_SIZE), size) + : malloc(0); if (p && (flags & __GFP_ZERO)) memset(p, 0, size); |