[SLUB 3/3] Configurable slub_max_order

From: Christoph Lameter
Date: Sat Mar 10 2007 - 21:11:27 EST


Add slub_max_order

Avoid slabs getting to large. Do no longer enforce slub_min_objects
if the slab gets bigger than slub_max_order.

I am not sure if we really want this. Maybe we should make the
selection of the base page size depending on page allocator
defrag behavior? I.e. try to restrict allocations to order 0 and order 2
so that can limit fragmentation?

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>

Index: linux-2.6.21-rc3/mm/slub.c
===================================================================
--- linux-2.6.21-rc3.orig/mm/slub.c 2007-03-10 13:14:06.000000000 -0800
+++ linux-2.6.21-rc3/mm/slub.c 2007-03-10 13:14:11.000000000 -0800
@@ -1211,6 +1211,7 @@ static __always_inline struct page *get_
* take the list_lock.
*/
static int slub_min_order = 0;
+static int slub_max_order = 4;

/*
* Minimum number of objects per slab. This is necessary in order to
@@ -1249,7 +1250,11 @@ static int calculate_order(int size)
order < MAX_ORDER; order++) {
unsigned long slab_size = PAGE_SIZE << order;

- if (slab_size < slub_min_objects * size)
+ if (slub_max_order > order &&
+ slab_size < slub_min_objects * size)
+ continue;
+
+ if (slab_size < size)
continue;

rem = slab_size % size;
@@ -1637,6 +1642,15 @@ static int __init setup_slub_min_order(c

__setup("slub_min_order=", setup_slub_min_order);

+static int __init setup_slub_max_order(char *str)
+{
+ get_option (&str, &slub_max_order);
+
+ return 1;
+}
+
+__setup("slub_max_order=", setup_slub_max_order);
+
static int __init setup_slub_min_objects(char *str)
{
get_option (&str, &slub_min_objects);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/