提交 818cf590 编写于 作者: D David Rientjes 提交者: 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: NChristoph Lameter <cl@linux-foundation.org>
Signed-off-by: NDavid Rientjes <rientjes@google.com>
Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册