From: Catalin Marinas <catalin.marinas@arm.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [2.6.32-rc3 kmemleak] WARNING: atkernel/lockdep.c:3161check_flags+0xbe/0x180()
Date: Wed, 14 Oct 2009 13:22:52 +0100 [thread overview]
Message-ID: <1255522972.15103.8.camel@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <200910142055.HJH56741.FLOFSJOQHtFVMO@I-love.SAKURA.ne.jp>
On Wed, 2009-10-14 at 20:55 +0900, Tetsuo Handa wrote:
> Tetsuo Handa wrote:
> > > This is the "DEBUG_LOCKS_WARN_ON(current->softirqs_enabled)" warning.
> > > I'm not sure why this happens but from the trace it seems that kmemleak
> > > is being called recursively via alloc_slabmgmt() which is caused by
> > > kmem_cache_alloc() called from create_object() in kmemleak.c.
> > If what my guess shown below is correct,
> > (object_cache->slabp_cache->flags & SLAB_NOLEAKTRACE) == 0
> > is triggering recursive calls.
>
> I applied below patch
>
> --- linux-2.6.32-rc4/mm/slab.c 2009-10-14 16:22:44.962007072 +0900
> +++ linux-2.6.32-rc4-ccs/mm/slab.c 2009-10-14 16:08:14.000000000 +0900
> @@ -2573,6 +2573,8 @@
> struct slab *slabp;
>
> if (OFF_SLAB(cachep)) {
> + BUG_ON((cachep->flags & SLAB_NOLEAKTRACE) &&
> + !(cachep->slabp_cache->flags & SLAB_NOLEAKTRACE));
> /* Slab management obj is off-slab. */
> slabp = kmem_cache_alloc_node(cachep->slabp_cache,
> local_flags, nodeid);
>
> and verified that (cachep->slabp_cache->flags & SLAB_NOLEAKTRACE) == 0 is
> triggering recursive call.
> This is not locking related problem. This is stack overflow problem
I was looking at the same code but in my platform, OFF_SLAB(cachep) for
the kmemleak caches is always 0. I only added:
BUG_ON(cachep->flags & SLAB_NOLEAKTRACE);
and it never triggered but I need to enable more debugging features as
in your .config and re-run.
I assume you haven't modified the kmemleak.c file to increase the
MAX_TRACE size.
I don't think we should add SLAB_NOLEAKTRACE to slabmgmt since in theory
it should work. Is there a slabmgmt allocated for each
kmem_cache_alloc()? If yes, it will indeed get into infinite recursive
calls. If not, kmemleak should be able to cope though in some situations
it may still overflow.
Until I manage to reproduce the problem, could you please try the patch
below:
diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481..f8f671b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2263,7 +2263,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
* (bootstrapping cannot cope with offslab caches so don't do
* it too early on.)
*/
- if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init)
+ if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init &&
+ !(cachep->flags & SLAB_NOLEAKTRACE))
/*
* Size is large, assume best to place the slab management obj
* off-slab (should allow better packing of objs).
Thanks.
--
Catalin
next prev parent reply other threads:[~2009-10-14 12:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-05 3:15 [2.6.32-rc3 kmemleak] WARNING: at kernel/lockdep.c:3161 check_flags+0xbe/0x180() Tetsuo Handa
2009-10-05 8:55 ` Catalin Marinas
2009-10-07 15:51 ` Paul E. McKenney
2009-10-08 12:34 ` [2.6.32-rc3 kmemleak] WARNING: at kernel/lockdep.c:3161check_flags+0xbe/0x180() Tetsuo Handa
2009-10-08 12:42 ` Catalin Marinas
2009-10-13 3:17 ` Tetsuo Handa
2009-10-13 12:00 ` Catalin Marinas
2009-10-13 12:57 ` [2.6.32-rc3 kmemleak] WARNING: at kernel/lockdep.c:3161 check_flags+0xbe/0x180() Tetsuo Handa
2009-10-13 15:25 ` [2.6.32-rc3 kmemleak] WARNING: atkernel/lockdep.c:3161check_flags+0xbe/0x180() Tetsuo Handa
2009-10-14 11:55 ` Tetsuo Handa
2009-10-14 12:22 ` Catalin Marinas [this message]
2009-10-14 13:12 ` [2.6.32-rc3 kmemleak] WARNING:atkernel/lockdep.c:3161check_flags+0xbe/0x180() Tetsuo Handa
2009-10-14 14:55 ` Catalin Marinas
2009-10-14 21:50 ` [2.6.32-rc3 kmemleak] WARNING: at kernel/lockdep.c:3161 check_flags+0xbe/0x180() Tetsuo Handa
2009-10-15 3:52 ` Tetsuo Handa
2009-10-15 8:45 ` Catalin Marinas
2009-10-08 12:39 ` Catalin Marinas
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=1255522972.15103.8.camel@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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®