From: Andrew Morton <akpm@osdl.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: mingo@elte.hu, sekharan@us.ibm.com, linux-kernel@vger.kernel.org,
nagar@watson.ibm.com, balbir@in.ibm.com, arjan@infradead.org
Subject: Re: [patch] lockdep: annotate mm/slab.c
Date: Thu, 13 Jul 2006 14:30:58 -0700 [thread overview]
Message-ID: <20060713143058.383b00a5.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0607131147530.5623@g5.osdl.org>
On Thu, 13 Jul 2006 11:50:01 -0700 (PDT)
Linus Torvalds <torvalds@osdl.org> wrote:
>
>
> On Thu, 13 Jul 2006, Ingo Molnar wrote:
> >
> > +#ifdef CONFIG_LOCKDEP
> > +
> > +/*
> > + * 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 put on-slab caches into a separate lock-class.
> > + */
> > +static struct lock_class_key on_slab_key;
> > +
> > +static inline void init_lock_keys(struct cache_sizes *s)
> > +{
> > + int q;
> > +
> > + for (q = 0; q < MAX_NUMNODES; q++) {
> > + if (!s->cs_cachep->nodelists[q] || OFF_SLAB(s->cs_cachep))
> > + continue;
> > + lockdep_set_class(&s->cs_cachep->nodelists[q]->list_lock,
> > + &on_slab_key);
> > + }
> > +}
> > +
> > +#else
> > +static inline void init_lock_keys(struct cache_sizes *s)
> > +{
> > +}
> > +#endif
>
> Why isn't the "on_slab_key" local to just the init_lock_keys() function,
> and the #ifdef around it all?
>
> Ie just
>
> static inline void init_lock_keys(struct cache_sizes *s)
> {
> #ifdef CONFIG_LOCKDEP
> static struct lock_class_key on_slab_key;
> int q;
>
> for (q = 0; q < MAX_NUMNODES; q++) {
> ...
> #endif CONFIG_LOCKDEP
> }
>
> instead?
>
It could be wholly hidded inside a macro
#define lockdep_go_away(p) {
static struct lock_class_key foo;
lockdep_set_class(p, &foo);
}
But istr suggesting that a couple of weeks ago and was given a
good-sounding reason which I forget.
At least when the code laid out as Ingo proposed, we have room for a
decent comment, which is rather desirable for this sort of thing.
next prev parent reply other threads:[~2006-07-13 21:31 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
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 [this message]
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=20060713143058.383b00a5.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=balbir@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nagar@watson.ibm.com \
--cc=sekharan@us.ibm.com \
--cc=torvalds@osdl.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.