Commit 0fa1419b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] slab: tune batchcounts for large objects

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.
parent 3abd0aea
......@@ -2175,7 +2175,9 @@ static void enable_cpucache (kmem_cache_t *cachep)
* 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_t *cachep)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment