Commit cf336416 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Avoid losing timer ticks when slab debug is enabled.

Patch from Manfred Spraul <manfred@colorfullife.com>

When slab debugging is enabled we're holding off interrupts for too long
(more than a jiffy), so reduce the alloc/free batching size when slab debug
is enabled.
parent ee3ddbbd
...@@ -2048,6 +2048,14 @@ static void enable_cpucache (kmem_cache_t *cachep) ...@@ -2048,6 +2048,14 @@ static void enable_cpucache (kmem_cache_t *cachep)
int err; int err;
int limit; int limit;
/* The head array serves three purposes:
* - create a LIFO ordering, i.e. return objects that are cache-warm
* - reduce the number of spinlock operations.
* - reduce the number of linked list operations on the slab and
* bufctl chains: array operations are cheaper.
* The numbers are guessed, we should auto-tune as described by
* Bonwick.
*/
if (cachep->objsize > PAGE_SIZE) if (cachep->objsize > PAGE_SIZE)
limit = 8; limit = 8;
else if (cachep->objsize > 1024) else if (cachep->objsize > 1024)
...@@ -2057,6 +2065,14 @@ static void enable_cpucache (kmem_cache_t *cachep) ...@@ -2057,6 +2065,14 @@ static void enable_cpucache (kmem_cache_t *cachep)
else else
limit = 248; limit = 248;
#ifndef DEBUG
/* With debugging enabled, large batchcount lead to excessively
* long periods with disabled local interrupts. Limit the
* batchcount
*/
if (limit > 32)
limit = 32;
#endif
err = do_tune_cpucache(cachep, limit, limit/2); err = do_tune_cpucache(cachep, limit, limit/2);
if (err) if (err)
printk(KERN_ERR "enable_cpucache failed for %s, error %d.\n", printk(KERN_ERR "enable_cpucache failed for %s, error %d.\n",
......
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