aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2009-04-23 02:58:22 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-04-23 02:58:22 -0400
commit818cf5909701806285d977f7a9365c5cadb062a7 (patch)
treef3a4d1f11d6ef32738f761d258e502b8791b199e /mm
parentf4efdd65b754ebbf41484d3a2255c59282720650 (diff)
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: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm')
-rw-r--r--mm/slub.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 7ab54ecbd3f3..0e1247ed2a06 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1909,7 +1909,7 @@ static inline int calculate_order(int size)
1909 * Doh this slab cannot be placed using slub_max_order. 1909 * Doh this slab cannot be placed using slub_max_order.
1910 */ 1910 */
1911 order = slab_order(size, 1, MAX_ORDER, 1); 1911 order = slab_order(size, 1, MAX_ORDER, 1);
1912 if (order <= MAX_ORDER) 1912 if (order < MAX_ORDER)
1913 return order; 1913 return order;
1914 return -ENOSYS; 1914 return -ENOSYS;
1915} 1915}
@@ -2522,6 +2522,7 @@ __setup("slub_min_order=", setup_slub_min_order);
2522static int __init setup_slub_max_order(char *str) 2522static int __init setup_slub_max_order(char *str)
2523{ 2523{
2524 get_option(&str, &slub_max_order); 2524 get_option(&str, &slub_max_order);
2525 slub_max_order = min(slub_max_order, MAX_ORDER - 1);
2525 2526
2526 return 1; 2527 return 1;
2527} 2528}