[SLUB 3/3] Guarantee minimum number of objects in a slab

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christoph Lameter
Date: Tuesday, March 6, 2007 - 7:35 pm

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 <clameter@sgi.com>

Index: linux-2.6.21-rc2-mm1/mm/slub.c
===================================================================
--- linux-2.6.21-rc2-mm1.orig/mm/slub.c	2007-03-06 17:57:11.000000000 -0800
+++ linux-2.6.21-rc2-mm1/mm/slub.c	2007-03-06 17:57:15.000000000 -0800
@@ -1201,6 +1201,12 @@ static __always_inline struct page *get_
 static int slub_min_order = 0;
 
 /*
+ * Minumum 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 = 4;
+
+/*
  * Merge control. If this is set then no merging of slab caches will occur.
  */
 static int slub_nomerge = 0;
@@ -1232,7 +1238,7 @@ static int calculate_order(int size)
 			order < MAX_ORDER; order++) {
 		unsigned long slab_size = PAGE_SIZE << order;
 
-		if (slab_size < size)
+		if (slab_size < slub_min_objects * size)
 			continue;
 
 		rem = slab_size % size;
@@ -1624,6 +1630,15 @@ static int __init setup_slub_min_order(c
 
 __setup("slub_min_order=", setup_slub_min_order);
 
+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;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Tue Mar 6, 7:35 pm)
[SLUB 1/3] SLUB core, Christoph Lameter, (Tue Mar 6, 7:35 pm)
[SLUB 3/3] Guarantee minimum number of objects in a slab, Christoph Lameter, (Tue Mar 6, 7:35 pm)
Re: [SLUB 2/3] Large kmalloc pass through. Removal of larg ..., Christoph Lameter, (Wed Mar 7, 11:23 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Mel Gorman, (Thu Mar 8, 3:54 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Thu Mar 8, 9:48 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Mel Gorman, (Thu Mar 8, 10:40 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Thu Mar 8, 10:46 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Thu Mar 8, 11:16 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Thu Mar 8, 2:54 pm)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Mel Gorman, (Fri Mar 9, 6:55 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Mel Gorman, (Fri Mar 9, 7:00 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Mel Gorman, (Fri Mar 9, 8:06 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Fri Mar 9, 9:40 am)
Re: [SLUB 0/3] SLUB: The unqueued slab allocator V4, Christoph Lameter, (Fri Mar 9, 10:21 am)