Guarantee a mininum number of objects per slab The number of objects per slab is important for SLUB because it determines the number of allocations that can be performed without having to consult per node slab lists. Add another boot option "min_objects=xx" that allows the configuration of the objects per slab. This is similar to SLABS queue configurations. Set the default of objects to 4. This will increase the page order for certain slab objects. Signed-off-by: Christoph Lameter Index: linux-2.6.21-rc3/mm/slub.c =================================================================== --- linux-2.6.21-rc3.orig/mm/slub.c 2007-03-09 12:51:47.000000000 -0800 +++ linux-2.6.21-rc3/mm/slub.c 2007-03-09 13:01:59.000000000 -0800 @@ -1216,6 +1216,12 @@ static int slub_min_objects = 8; /* + * Minimum number of objects per slab. This is necessary in order to + * reduce locking overhead. Similar to the queue size in SLAB. + */ +static int slub_min_objects = 8; + +/* * Merge control. If this is set then no merging of slab caches will occur. */ static int slub_nomerge = 0; @@ -1250,7 +1256,7 @@ slab_size < slub_min_objects * size) continue; - if (slab_size < size) + if (slab_size < slub_min_objects * size) continue; rem = slab_size % size; @@ -1661,6 +1667,15 @@ __setup("slub_min_objects=", setup_slub_min_objects); +static int __init setup_slub_min_objects(char *str) +{ + get_option (&str, &slub_min_objects); + + return 1; +} + +__setup("slub_min_objects=", setup_slub_min_objects); + static int __init setup_slub_nomerge(char *str) { slub_nomerge = 1;