linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Matt Mackall <mpm@selenic.com>,
	linux-mm@kvack.org
Subject: slab vs. slub kmem cache name inconsistency
Date: Tue, 02 Oct 2012 11:40:40 +0200	[thread overview]
Message-ID: <1349170840.10698.14.camel@jlt4.sipsolutions.net> (raw)

Hi,

I just noticed that slub's kmem_cache_create() will kstrdup() the name,
while slab doesn't. That's a little confusing, since when you look at
slub you can easily get away with passing a string you built on the
stack, while that will then lead to very strange results (and possibly
crashes?) with slab. The slab kernel-doc string always says this:

 * @name must be valid until the cache is destroyed. This implies that
 * the module calling this has to destroy the cache before getting unloaded.

Is there any reason for this difference, or should slab also kstrdup(),
or should slub not do it? Or maybe slub should have a "oops, name is on
stack" warning/check?

johannes

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2012-10-02  9:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-02  9:40 Johannes Berg [this message]
2012-10-02 11:05 ` slab vs. slub kmem cache name inconsistency JoonSoo Kim
2012-10-02 11:08   ` Johannes Berg
2012-10-02 14:43 ` Christoph Lameter

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=1349170840.10698.14.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=cl@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@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;
as well as URLs for NNTP newsgroup(s).