From: Manfred Spraul <manfred@colorfullife.com>

Now that slab supports monster objects (up to 32MB) for !CONFIG_MMU we really
don't want to keep spare instances of them in the slab head arrays.

- limit head array sizes for huge slab caches to one object per cpu.

- round the batch count up for default head array sizing - batch count 0 is
  illegal.

(forwarded by akpm@digeo.com)


 mm/slab.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN mm/slab.c~slab-large-obj-tuning mm/slab.c
--- 25/mm/slab.c~slab-large-obj-tuning	2003-03-20 03:11:47.000000000 -0800
+++ 25-akpm/mm/slab.c	2003-03-20 03:11:47.000000000 -0800
@@ -2175,7 +2175,9 @@ static void enable_cpucache (kmem_cache_
 	 * The numbers are guessed, we should auto-tune as described by
 	 * Bonwick.
 	 */
-	if (cachep->objsize > PAGE_SIZE)
+	if (cachep->objsize > 131072)
+		limit = 1;
+	else if (cachep->objsize > PAGE_SIZE)
 		limit = 8;
 	else if (cachep->objsize > 1024)
 		limit = 54;
@@ -2192,7 +2194,7 @@ static void enable_cpucache (kmem_cache_
 	if (limit > 32)
 		limit = 32;
 #endif
-	err = do_tune_cpucache(cachep, limit, limit/2);
+	err = do_tune_cpucache(cachep, limit, (limit+1)/2);
 	if (err)
 		printk(KERN_ERR "enable_cpucache failed for %s, error %d.\n",
 					cachep->name, -err);

_