[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=G6ge_FYWVDFw3HSjtF4EdDVyDg3TWxxJgYCYc@mail.gmail.com>
Date: Tue, 14 Sep 2010 11:02:39 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Pekka Enberg <penberg@...nel.org>
Cc: linux-kernel@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH 1/2] SLUB: Fix merged slab cache names
On Tue, Sep 14, 2010 at 10:06 AM, Pekka Enberg <penberg@...nel.org> wrote:
>
> @@ -3218,6 +3221,18 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
> down_write(&slub_lock);
> s = find_mergeable(size, align, flags, name, ctor);
> if (s) {
> + if (!(s->flags & SLAB_DYNAMIC_NAME)) {
> + const char *new_name;
> +
> + new_name = kstrdup(s->name, GFP_KERNEL);
> + if (!new_name)
> + goto err;
> +
> + s->name = new_name;
Once you do this, please actually update the name to list the first
few different names.
Since the SLAB_DYNAMIC_NAME test mean that this will only happen once,
I would suggest something like just doing
size = strlen(s->name) + strlen(name) + sizeof(", ...");
new_name = kmalloc(size, GFP_KERNEL);
if (!new_name)
return -ENOMEM;
snprintf(new_name, "%s, %s...", s->name, name);
so that you get the two first names listed. Sure, it will be
wrong/incomplete if there's lots of merging, but it will be visually
very obvious in /proc/slabinfo and in the debug messages.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists