Skip to content

Commit

Permalink
slub: enforce MAX_ORDER
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
rientjes authored and Pekka Enberg committed Apr 23, 2009
1 parent f4efdd6 commit 818cf59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ static inline int calculate_order(int size)
* Doh this slab cannot be placed using slub_max_order.
*/
order = slab_order(size, 1, MAX_ORDER, 1);
if (order <= MAX_ORDER)
if (order < MAX_ORDER)
return order;
return -ENOSYS;
}
Expand Down Expand Up @@ -2522,6 +2522,7 @@ __setup("slub_min_order=", setup_slub_min_order);
static int __init setup_slub_max_order(char *str)
{
get_option(&str, &slub_max_order);
slub_max_order = min(slub_max_order, MAX_ORDER - 1);

return 1;
}
Expand Down

0 comments on commit 818cf59

Please sign in to comment.