From: Peter Zijlstra <peterz@infradead.org>
To: Christoph Lameter <cl@gentwo.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Sitsofe Wheeler <sitsofe@yahoo.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, penberg@kernel.org,
mpm@selenic.com, linux-mm@kvack.org,
David Rientjes <rientjes@google.com>
Subject: Re: lockdep recursive locking detected (rcu_kthread / __cache_free)
Date: Tue, 04 Oct 2011 16:40:25 +0200 [thread overview]
Message-ID: <1317739225.32543.9.camel@twins> (raw)
In-Reply-To: <alpine.DEB.2.00.1110040916330.8522@router.home>
On Tue, 2011-10-04 at 09:28 -0500, Christoph Lameter wrote:
> On Mon, 3 Oct 2011, Paul E. McKenney wrote:
>
> > On Mon, Oct 03, 2011 at 03:46:11PM -0500, Christoph Lameter wrote:
> > > On Mon, 3 Oct 2011, Paul E. McKenney wrote:
> > >
> > > > The first lock was acquired here in an RCU callback. The later lock that
> > > > lockdep complained about appears to have been acquired from a recursive
> > > > call to __cache_free(), with no help from RCU. This looks to me like
> > > > one of the issues that arise from the slab allocator using itself to
> > > > allocate slab metadata.
> > >
> > > Right. However, this is a false positive since the slab cache with
> > > the metadata is different from the slab caches with the slab data. The slab
> > > cache with the metadata does not use itself any metadata slab caches.
> >
> > Wouldn't it be possible to pass a new flag to the metadata slab caches
> > upon creation so that their locks could be placed in a separate lock
> > class? Just allocate a separate lock_class_key structure for each such
> > lock in that case, and then use lockdep_set_class_and_name to associate
> > that structure with the corresponding lock. I do this in kernel/rcutree.c
> > in order to allow the rcu_node tree's locks to nest properly.
>
> We could give the kmalloc array a different class from created slab
> caches. That should have the desired effect.
>
> But that seems to be already the case (looking at init_node_lock_keys).
> Non OFF_SLAB caches seem to be getting a different lock class? Why is this
> not working?
>
> static void init_node_lock_keys(int q)
> {
> struct cache_sizes *s = malloc_sizes;
>
> if (g_cpucache_up != FULL)
> return;
>
> for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) {
> struct kmem_list3 *l3;
>
> l3 = s->cs_cachep->nodelists[q];
> if (!l3 || OFF_SLAB(s->cs_cachep))
> continue;
>
> slab_set_lock_classes(s->cs_cachep, &on_slab_l3_key,
> &on_slab_alc_key, q);
> }
> }
Right, so we recently poked at this to fix some other splats, see:
30765b92ada267c5395fc788623cb15233276f5c
83835b3d9aec8e9f666d8223d8a386814f756266
It could of course be I got confused and broke stuff instead, could
someone who knows slab (I guess that's either Pekka, Christoph or David)
stare at those patches?
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Christoph Lameter <cl@gentwo.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Sitsofe Wheeler <sitsofe@yahoo.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, penberg@kernel.org,
mpm@selenic.com, linux-mm@kvack.org,
David Rientjes <rientjes@google.com>
Subject: Re: lockdep recursive locking detected (rcu_kthread / __cache_free)
Date: Tue, 04 Oct 2011 16:40:25 +0200 [thread overview]
Message-ID: <1317739225.32543.9.camel@twins> (raw)
In-Reply-To: <alpine.DEB.2.00.1110040916330.8522@router.home>
On Tue, 2011-10-04 at 09:28 -0500, Christoph Lameter wrote:
> On Mon, 3 Oct 2011, Paul E. McKenney wrote:
>
> > On Mon, Oct 03, 2011 at 03:46:11PM -0500, Christoph Lameter wrote:
> > > On Mon, 3 Oct 2011, Paul E. McKenney wrote:
> > >
> > > > The first lock was acquired here in an RCU callback. The later lock that
> > > > lockdep complained about appears to have been acquired from a recursive
> > > > call to __cache_free(), with no help from RCU. This looks to me like
> > > > one of the issues that arise from the slab allocator using itself to
> > > > allocate slab metadata.
> > >
> > > Right. However, this is a false positive since the slab cache with
> > > the metadata is different from the slab caches with the slab data. The slab
> > > cache with the metadata does not use itself any metadata slab caches.
> >
> > Wouldn't it be possible to pass a new flag to the metadata slab caches
> > upon creation so that their locks could be placed in a separate lock
> > class? Just allocate a separate lock_class_key structure for each such
> > lock in that case, and then use lockdep_set_class_and_name to associate
> > that structure with the corresponding lock. I do this in kernel/rcutree.c
> > in order to allow the rcu_node tree's locks to nest properly.
>
> We could give the kmalloc array a different class from created slab
> caches. That should have the desired effect.
>
> But that seems to be already the case (looking at init_node_lock_keys).
> Non OFF_SLAB caches seem to be getting a different lock class? Why is this
> not working?
>
> static void init_node_lock_keys(int q)
> {
> struct cache_sizes *s = malloc_sizes;
>
> if (g_cpucache_up != FULL)
> return;
>
> for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) {
> struct kmem_list3 *l3;
>
> l3 = s->cs_cachep->nodelists[q];
> if (!l3 || OFF_SLAB(s->cs_cachep))
> continue;
>
> slab_set_lock_classes(s->cs_cachep, &on_slab_l3_key,
> &on_slab_alc_key, q);
> }
> }
Right, so we recently poked at this to fix some other splats, see:
30765b92ada267c5395fc788623cb15233276f5c
83835b3d9aec8e9f666d8223d8a386814f756266
It could of course be I got confused and broke stuff instead, could
someone who knows slab (I guess that's either Pekka, Christoph or David)
stare at those patches?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-10-04 14:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-03 17:53 lockdep recursive locking detected (rcu_kthread / __cache_free) Sitsofe Wheeler
2011-10-03 20:31 ` Paul E. McKenney
2011-10-03 20:31 ` Paul E. McKenney
2011-10-03 20:46 ` Christoph Lameter
2011-10-03 20:46 ` Christoph Lameter
2011-10-03 21:06 ` Peter Zijlstra
2011-10-03 21:06 ` Peter Zijlstra
2011-10-03 21:47 ` Paul E. McKenney
2011-10-03 21:47 ` Paul E. McKenney
2011-10-04 14:28 ` Christoph Lameter
2011-10-04 14:28 ` Christoph Lameter
2011-10-04 14:40 ` Peter Zijlstra [this message]
2011-10-04 14:40 ` Peter Zijlstra
2011-10-04 14:50 ` Christoph Lameter
2011-10-04 14:50 ` Christoph Lameter
2011-10-04 15:09 ` Peter Zijlstra
2011-10-04 15:09 ` Peter Zijlstra
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=1317739225.32543.9.camel@twins \
--to=peterz@infradead.org \
--cc=cl@gentwo.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=mpm@selenic.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=sitsofe@yahoo.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 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.