From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>,
Manfred Spraul <manfred@colorfullife.com>,
"Shai Fultheim (Shai@scalex86.org)" <shai@scalex86.org>,
Christoph Lameter <clameter@engr.sgi.com>,
Alok Kataria <alok.kataria@calsoftinc.com>,
sonny@burdell.org
Subject: [patch 1/3] NUMA slab locking fixes -- slab-colour-next fix
Date: Fri, 3 Feb 2006 12:55:14 -0800 [thread overview]
Message-ID: <20060203205514.GD3653@localhost.localdomain> (raw)
In-Reply-To: <20060203205341.GC3653@localhost.localdomain>
colour_next is used as an index to add a colouring offset to a new slab
in the cache (colour_off * colour_next). Now with the NUMA aware slab
allocator, it makes sense to colour slabs added on the same node
sequentially with colour_next.
This patch moves the colouring index "colour_next" per-node by placing it
on kmem_list3 rather than kmem_cache.
This also avoids taking the cachep->spinlock on the alloc path at
cache_grow.
Signed-off-by: Alok N Kataria <alokk@calsoftinc.com>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Index: linux-2.6.16-rc1mm4/mm/slab.c
===================================================================
--- linux-2.6.16-rc1mm4.orig/mm/slab.c 2006-01-29 20:20:20.000000000 -0800
+++ linux-2.6.16-rc1mm4/mm/slab.c 2006-01-29 20:23:28.000000000 -0800
@@ -294,6 +294,7 @@ struct kmem_list3 {
unsigned long next_reap;
int free_touched;
unsigned int free_limit;
+ unsigned int colour_next; /* Per-node cache coloring */
spinlock_t list_lock;
struct array_cache *shared; /* shared per node */
struct array_cache **alien; /* on other nodes */
@@ -344,6 +345,7 @@ static void kmem_list3_init(struct kmem_
INIT_LIST_HEAD(&parent->slabs_free);
parent->shared = NULL;
parent->alien = NULL;
+ parent->colour_next = 0;
spin_lock_init(&parent->list_lock);
parent->free_objects = 0;
parent->free_touched = 0;
@@ -390,7 +392,6 @@ struct kmem_cache {
size_t colour; /* cache colouring range */
unsigned int colour_off; /* colour offset */
- unsigned int colour_next; /* cache colouring */
struct kmem_cache *slabp_cache;
unsigned int slab_size;
unsigned int dflags; /* dynamic flags */
@@ -1127,7 +1128,6 @@ void __init kmem_cache_init(void)
BUG();
cache_cache.colour = left_over / cache_cache.colour_off;
- cache_cache.colour_next = 0;
cache_cache.slab_size = ALIGN(cache_cache.num * sizeof(kmem_bufctl_t) +
sizeof(struct slab), cache_line_size());
@@ -2334,18 +2334,19 @@ static int cache_grow(struct kmem_cache
*/
ctor_flags |= SLAB_CTOR_ATOMIC;
- /* About to mess with non-constant members - lock. */
+ /* Take the l3 list lock to change the colour_next on this node */
check_irq_off();
- spin_lock(&cachep->spinlock);
+ l3 = cachep->nodelists[nodeid];
+ spin_lock(&l3->list_lock);
/* Get colour for the slab, and cal the next value. */
- offset = cachep->colour_next;
- cachep->colour_next++;
- if (cachep->colour_next >= cachep->colour)
- cachep->colour_next = 0;
- offset *= cachep->colour_off;
+ offset = l3->colour_next;
+ l3->colour_next++;
+ if (l3->colour_next >= cachep->colour)
+ l3->colour_next = 0;
+ spin_unlock(&l3->list_lock);
- spin_unlock(&cachep->spinlock);
+ offset *= cachep->colour_off;
check_irq_off();
if (local_flags & __GFP_WAIT)
@@ -2377,7 +2378,6 @@ static int cache_grow(struct kmem_cache
if (local_flags & __GFP_WAIT)
local_irq_disable();
check_irq_off();
- l3 = cachep->nodelists[nodeid];
spin_lock(&l3->list_lock);
/* Make slab active. */
next prev parent reply other threads:[~2006-02-03 20:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-03 20:53 [patch 0/3] NUMA slab locking fixes Ravikiran G Thirumalai
2006-02-03 20:55 ` Ravikiran G Thirumalai [this message]
2006-02-03 20:56 ` [patch 2/3] NUMA slab locking fixes -- slab locking irq optimizations Ravikiran G Thirumalai
2006-02-03 20:57 ` [patch 3/3] NUMA slab locking fixes -- slab cpu hotplug fix Ravikiran G Thirumalai
2006-02-03 22:07 ` [patch 0/3] NUMA slab locking fixes Andrew Morton
2006-02-03 23:06 ` Christoph Lameter
2006-02-04 1:08 ` Ravikiran G Thirumalai
2006-02-04 1:15 ` [patch 1/3] NUMA slab locking fixes -- move color_next to l3 Ravikiran G Thirumalai
2006-02-04 1:22 ` [patch 0/3] NUMA slab locking fixes Andrew Morton
2006-02-04 1:28 ` [patch 2/3] NUMA slab locking fixes - move irq disabling from cahep->spinlock to l3 lock Ravikiran G Thirumalai
2006-02-04 9:48 ` Andrew Morton
2006-02-06 22:51 ` Ravikiran G Thirumalai
2006-02-06 23:30 ` Andrew Morton
2006-02-07 0:21 ` Christoph Lameter
2006-02-07 7:36 ` Pekka J Enberg
2006-02-07 7:50 ` Ravikiran G Thirumalai
2006-02-07 7:55 ` Pekka J Enberg
2006-02-04 1:29 ` [patch 3/3] NUMA slab locking fixes -- fix cpu down and up locking Ravikiran G Thirumalai
2006-02-04 10:03 ` Andrew Morton
2006-02-04 10:05 ` Andrew Morton
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=20060203205514.GD3653@localhost.localdomain \
--to=kiran@scalex86.org \
--cc=akpm@osdl.org \
--cc=alok.kataria@calsoftinc.com \
--cc=clameter@engr.sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=shai@scalex86.org \
--cc=sonny@burdell.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.