From: Jeff Layton <jlayton@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Boaz Harrosh <bharrosh@panasas.com>,
Stanislaw Gruszka <sgruszka@redhat.com>,
Stephen Boyd <sboyd@codeaurora.org>,
linux-kernel@vger.kernel.org, bfields@redhat.com,
linux-nfs@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: Re: WARNING: at lib/debugobjects.c:262 debug_print_object+0x8c/0xb0()
Date: Wed, 25 Jan 2012 09:46:16 -0500 [thread overview]
Message-ID: <20120125094616.6e90d113@tlielax.poochiereds.net> (raw)
In-Reply-To: <alpine.LFD.2.02.1201251502210.2716@ionos>
On Wed, 25 Jan 2012 15:05:03 +0100 (CET)
Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 24 Jan 2012, Jeff Layton wrote:
> > > Still, I wonder if there are other problems like this around. The slab
> > > allocators seem to call debug_check_no_obj_freed() on kmem_cache_free,
> > > but parts of the objects themselves (like the timer in the work object
> > > here) get initialized in other places and aren't necessarily
> > > reinitialized when they're recycled out of the slab...
> > >
> >
> > On second thought...getting rid of the ctor function here might be
> > problematic. We have to call inode_init_once, etc...
> >
> > Almost all of the inode slabs have one, so I've settled for just moving
> > the INIT_DELAYED_WORK call out of init_once and into rpc_alloc_inode. I
> > sent a patch to Trond and linux-nfs to do that. That will fix this
> > case, but I do wonder if there are other places in the kernel that have
> > similar problems with debugobject initialization.
>
> The problem is that debugobject requires that a newly allocated object
> is reinitialized and made available to the debugobjects code again
> simply because we remove it from the debugobjects core on
> kmem_cache_free().
>
> The real question is why the heck kmem_cache_alloc() does not call the
> ctor on each allocation and just expects the previously used and freed
> object to be in a consistent initialiazed state.
>
> Thanks,
>
> tglx
I believe that's by design. The comments at the top of slab.c say:
* This means, that your constructor is used only for newly allocated
* slabs and you must pass objects with the same initializations to
* kmem_cache_free.
I assume that it was done that way for efficiency, but not passing
"clean" objects to kmem_cache_free has been the source of bugs in the
past.
Rerunning the ctor should be safe. SLAB already does that when memory
poisoning is enabled. Perhaps we could make sure all the allocators do
that when debug objects are enabled?
OTOH, doing that might paper over bugs in some cases...
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2012-01-25 14:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 18:56 Jeff Layton
2012-01-22 8:46 ` Stephen Boyd
2012-01-22 12:14 ` Jeff Layton
2012-01-23 15:23 ` Jeff Layton
2012-01-24 7:45 ` Stanislaw Gruszka
2012-01-24 9:51 ` Boaz Harrosh
2012-01-24 12:36 ` Jeff Layton
2012-01-24 15:01 ` Boaz Harrosh
2012-01-24 16:32 ` Jeff Layton
2012-01-24 17:43 ` Jeff Layton
2012-01-25 14:05 ` Thomas Gleixner
2012-01-25 14:46 ` Jeff Layton [this message]
2012-01-25 14:47 ` Boaz Harrosh
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=20120125094616.6e90d113@tlielax.poochiereds.net \
--to=jlayton@redhat.com \
--cc=bfields@redhat.com \
--cc=bharrosh@panasas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sboyd@codeaurora.org \
--cc=sgruszka@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.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 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®