summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@engr.sgi.com>2006-03-22 00:09:07 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 07:54:05 -0800
commit1b55253a7f95adc82eb20937b57b3e3e32ba65df (patch)
tree5ab3f9e6efa5e2ed2a39843b95dcf95ddb89592a /mm
parentaab2207cf8d9c343b6b5f0e4d27e1732f8618d14 (diff)
[PATCH] slab: remove drain_array_locked
Remove drain_array_locked and use that opportunity to limit the time the l3 lock is taken further. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/mm/slab.c b/mm/slab.c
index d73b38e7d7e..3274144c0d1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2123,9 +2123,6 @@ static void check_spinlock_acquired_node(struct kmem_cache *cachep, int node)
#define check_spinlock_acquired_node(x, y) do { } while(0)
#endif
-static void drain_array_locked(struct kmem_cache *cachep,
- struct array_cache *ac, int force, int node);
-
static void drain_array(struct kmem_cache *cachep, struct kmem_list3 *l3,
struct array_cache *ac,
int force, int node);
@@ -3522,40 +3519,32 @@ static void enable_cpucache(struct kmem_cache *cachep)
cachep->name, -err);
}
-static void drain_array_locked(struct kmem_cache *cachep,
- struct array_cache *ac, int force, int node)
+/*
+ * Drain an array if it contains any elements taking the l3 lock only if
+ * necessary.
+ */
+void drain_array(struct kmem_cache *cachep, struct kmem_list3 *l3,
+ struct array_cache *ac, int force, int node)
{
int tofree;
- check_spinlock_acquired_node(cachep, node);
+ if (!ac || !ac->avail)
+ return;
if (ac->touched && !force) {
ac->touched = 0;
} else if (ac->avail) {
tofree = force ? ac->avail : (ac->limit + 4) / 5;
if (tofree > ac->avail)
tofree = (ac->avail + 1) / 2;
+ spin_lock_irq(&l3->list_lock);
free_block(cachep, ac->entry, tofree, node);
+ spin_unlock_irq(&l3->list_lock);
ac->avail -= tofree;
memmove(ac->entry, &(ac->entry[tofree]),
sizeof(void *) * ac->avail);
}
}
-
-/*
- * Drain an array if it contains any elements taking the l3 lock only if
- * necessary.
- */
-static void drain_array(struct kmem_cache *searchp, struct kmem_list3 *l3,
- struct array_cache *ac, int force, int node)
-{
- if (ac && ac->avail) {
- spin_lock_irq(&l3->list_lock);
- drain_array_locked(searchp, ac, force, node);
- spin_unlock_irq(&l3->list_lock);
- }
-}
-
/**
* cache_reap - Reclaim memory from caches.
* @unused: unused parameter