From: Christoph Lameter <clameter@engr.sgi.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, kiran@scalex86.org,
alokk@calsoftinc.com, Pekka Enberg <penberg@gmail.com>
Subject: slab: remove drain_array_locked
Date: Fri, 3 Mar 2006 16:51:25 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603031650440.15966@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0603031649340.15966@schroedinger.engr.sgi.com>
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>
Index: linux-2.6.16-rc5-mm2/mm/slab.c
===================================================================
--- linux-2.6.16-rc5-mm2.orig/mm/slab.c 2006-03-03 16:31:40.000000000 -0800
+++ linux-2.6.16-rc5-mm2/mm/slab.c 2006-03-03 16:43:43.000000000 -0800
@@ -2125,9 +2125,6 @@ static void check_spinlock_acquired_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);
@@ -3555,40 +3552,33 @@ static void enable_cpucache(struct kmem_
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.
- */
-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
next prev parent reply other threads:[~2006-03-04 0:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-03 23:36 cache_reap(): Further reduction in interrupt holdoff Christoph Lameter
2006-03-04 0:50 ` Make drain_array more universal by adding more parameters Christoph Lameter
2006-03-04 0:51 ` Christoph Lameter [this message]
2006-03-04 2:44 ` Do not disable interrupts for off node freeing Christoph Lameter
2006-03-06 7:49 ` cache_reap(): Further reduction in interrupt holdoff Pekka Enberg
2006-03-06 16:24 ` Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0603031650440.15966@schroedinger.engr.sgi.com \
--to=clameter@engr.sgi.com \
--cc=akpm@osdl.org \
--cc=alokk@calsoftinc.com \
--cc=kiran@scalex86.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).