From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "John Reiser" <jreiser@bitwagon.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: slab quirks in DEBUG, ctor, and initialization
Date: Mon, 17 Dec 2007 21:51:33 +0200 [thread overview]
Message-ID: <84144f020712171151j5e2a2934qc8bf2fbc9020a545@mail.gmail.com> (raw)
In-Reply-To: <47669A16.3010604@BitWagon.com>
Hi John,
On Dec 17, 2007 5:47 PM, John Reiser <jreiser@bitwagon.com> wrote:
> In mm/slab.c, the DEBUG variant of cache_alloc_debugcheck_after
> might call cachep->ctor(objp, cachep, 0); but the non-DEBUG
> variant does absolutely nothing. idr_pre_get is a routine
> which notices the difference.
How does ipr_pre_get notice this?
On Dec 17, 2007 5:47 PM, John Reiser <jreiser@bitwagon.com> wrote:
> Even when cache_alloc_debugcheck_after does invoke the ctor,
> then it is conditional upon cachep->flags & SLAB_POISON. This
> assumes that the only two states are poisoned and all-zero
> (from .bss static, or via a cleared new page frame.)
> So if SLAB_POISON is not specified, then a ctor which
> does anything other than memset(,0,) is out of luck.
> Instead: if a ctor is specified then it should be called
> for each successful allocation.
Sorry, I don't understand at all what's the problem is here. For the
common (non-poison) case, we initialize all objects *once* whenever a
cache is grown (see cache_grow calling cache_init_objs) which is the
whole point of having constructors. When poisoning is enabled, we
obviously cannot do this which is why we call the constructor for
every allocation.
Pekka
next prev parent reply other threads:[~2007-12-17 20:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-17 15:47 John Reiser
2007-12-17 19:51 ` Pekka Enberg [this message]
2007-12-17 21:19 ` John Reiser
2007-12-17 21:55 ` Pekka J Enberg
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=84144f020712171151j5e2a2934qc8bf2fbc9020a545@mail.gmail.com \
--to=penberg@cs.helsinki.fi \
--cc=jreiser@bitwagon.com \
--cc=linux-kernel@vger.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®