From: Arjan van de Ven <arjan@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch] lockdep: more annotations for mm/slab.c
Date: Thu, 13 Jul 2006 12:44:29 +0200 [thread overview]
Message-ID: <1152787469.3024.26.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <20060713091804.GA11572@elte.hu>
On Thu, 2006-07-13 at 11:18 +0200, Ingo Molnar wrote:
> * Andrew Morton <akpm@osdl.org> wrote:
>
> > > ---
> > > mm/slab.c | 45 +++++++++++++++++++++++++--------------------
> >
> > geeze, what fuss. Can't we just tell lockdep "the locking here is
> > correct, so buzz off"?
>
> well, lockdep already found a locking bug in slab.c, so by telling
> lockdep to buzz off we lose the proof of correctness :-)
>
> but i agree that this is getting a bit too intrusive. This patch is
> really just another expression of: 'slab locking is too complex', but i
> digress. Not all hope is lost though: Arjan thinks he can do a much
> simpler annotation.
I am hoping I can get away with just this patch; the idea is to give the
cache_cache slab a special lock type since it'll be nested all the time
(and has a natural ordering due to it's special position in the slab
code). I'm not yet sure I found all places where this stuff is
initialized (the slab code has gotten terribly complex with all the numa
stuff added to it); I've started to test this now at least and so far it
seems to work on my test box.
Index: linux-2.6.18-rc1/mm/slab.c
===================================================================
--- linux-2.6.18-rc1.orig/mm/slab.c
+++ linux-2.6.18-rc1/mm/slab.c
@@ -317,6 +317,16 @@ static void enable_cpucache(struct kmem_
static void cache_reap(void *unused);
/*
+ * Slab sometimes uses the kmalloc slabs to store the slab headers
+ * for other slabs "off slab".
+ * The locking for this is tricky in that it
+ * nests within the locks of all other slabs in a few
+ * places; to deal with this special locking we give
+ * this one slab a special class.
+ */
+static struct lock_class_key slab_name_lock_key;
+
+/*
* This function must be completely optimized away if a constant is passed to
* it. Mostly the same as what is in linux/slab.h except it returns an index.
*/
@@ -1443,6 +1453,7 @@ void __init kmem_cache_init(void)
/* Replace the static kmem_list3 structures for the boot cpu */
init_list(&cache_cache, &initkmem_list3[CACHE_CACHE],
numa_node_id());
+ lockdep_set_class(&(cache_cache.nodelists[numa_node_id()]->list_lock), &slab_name_lock_key);
for_each_online_node(node) {
init_list(malloc_sizes[INDEX_AC].cs_cachep,
next prev parent reply other threads:[~2006-07-13 10:44 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 3:59 Random panics seen in 2.6.18-rc1 Chandra Seetharaman
2006-07-13 7:12 ` Ingo Molnar
2006-07-13 7:28 ` Andrew Morton
2006-07-13 7:26 ` Ingo Molnar
2006-07-13 7:44 ` Andrew Morton
2006-07-13 7:46 ` Ingo Molnar
2006-07-13 8:49 ` Ingo Molnar
2006-07-13 8:42 ` Ingo Molnar
2006-07-13 8:46 ` [patch] lockdep: more annotations for mm/slab.c Ingo Molnar
2006-07-13 9:08 ` Andrew Morton
2006-07-13 9:18 ` Ingo Molnar
2006-07-13 10:44 ` Arjan van de Ven [this message]
2006-07-13 10:58 ` Arjan van de Ven
2006-07-13 12:44 ` [patch] lockdep: undo mm/slab.c annotation Ingo Molnar
2006-07-13 12:46 ` [patch] lockdep: annotate mm/slab.c Ingo Molnar
2006-07-13 15:45 ` Pekka Enberg
2006-07-13 19:55 ` Ingo Molnar
2006-07-13 15:58 ` Pekka Enberg
2006-07-13 18:56 ` Linus Torvalds
2006-07-13 19:21 ` Arjan van de Ven
2006-07-13 22:27 ` Christoph Lameter
2006-07-13 23:08 ` Alok kataria
2006-07-13 22:51 ` Christoph Lameter
2006-07-13 23:16 ` Andrew Morton
2006-07-14 2:29 ` Christoph Lameter
2006-07-14 2:46 ` Christoph Lameter
2006-07-14 3:02 ` Andrew Morton
2006-07-14 3:35 ` Christoph Lameter
2006-07-14 3:45 ` Christoph Lameter
2006-07-14 16:48 ` Alok kataria
2006-07-14 2:54 ` Andrew Morton
2006-07-14 2:59 ` Christoph Lameter
2006-07-13 19:32 ` Ingo Molnar
2006-07-13 18:50 ` Linus Torvalds
2006-07-13 19:06 ` Arjan van de Ven
2006-07-13 19:21 ` Linus Torvalds
2006-07-13 19:26 ` Arjan van de Ven
2006-07-13 19:17 ` Ingo Molnar
2006-07-13 19:19 ` Ingo Molnar
2006-07-13 21:30 ` Andrew Morton
2006-07-13 13:51 ` Random panics seen in 2.6.18-rc1 Chandra Seetharaman
2006-07-13 16:05 ` Chandra Seetharaman
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=1152787469.3024.26.camel@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®