diff options
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r-- | include/linux/slab.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 6fb2ae214152..a015236cc572 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -74,6 +74,21 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep, #endif /* + * The largest kmalloc size supported by the slab allocators is + * 32 megabyte (2^25) or the maximum allocatable page order if that is + * less than 32 MB. + * + * WARNING: Its not easy to increase this value since the allocators have + * to do various tricks to work around compiler limitations in order to + * ensure proper constant folding. + */ +#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT) <= 25 ? \ + (MAX_ORDER + PAGE_SHIFT) : 25) + +#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) +#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) + +/* * Common kmalloc functions provided by all allocators */ void *__kmalloc(size_t, gfp_t); |