Commit 818cf590 authored by David Rientjes's avatar David Rientjes Committed by Pekka Enberg

slub: enforce MAX_ORDER

slub_max_order may not be equal to or greater than MAX_ORDER.

Additionally, if a single object cannot be placed in a slab of
slub_max_order, it still must allocate slabs below MAX_ORDER.
Acked-by: default avatarChristoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent f4efdd65
...@@ -1909,7 +1909,7 @@ static inline int calculate_order(int size) ...@@ -1909,7 +1909,7 @@ static inline int calculate_order(int size)
* Doh this slab cannot be placed using slub_max_order. * Doh this slab cannot be placed using slub_max_order.
*/ */
order = slab_order(size, 1, MAX_ORDER, 1); order = slab_order(size, 1, MAX_ORDER, 1);
if (order <= MAX_ORDER) if (order < MAX_ORDER)
return order; return order;
return -ENOSYS; return -ENOSYS;
} }
...@@ -2522,6 +2522,7 @@ __setup("slub_min_order=", setup_slub_min_order); ...@@ -2522,6 +2522,7 @@ __setup("slub_min_order=", setup_slub_min_order);
static int __init setup_slub_max_order(char *str) static int __init setup_slub_max_order(char *str)
{ {
get_option(&str, &slub_max_order); get_option(&str, &slub_max_order);
slub_max_order = min(slub_max_order, MAX_ORDER - 1);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment