Re: linux-next: build failure after merge of the slab tree

From: Sedat Dilek
Date: Tue Feb 08 2011 - 12:11:13 EST


On Tue, Feb 8, 2011 at 4:55 PM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> Argh. I accidentally sent an older version of the patch. This one is the
> tested one.
>
>
> Subject: ext4: Remove use of kmem_cache_name
>
> Remove the use of kmem_cache_name from ext4. In order to do that we need to
> strdup the name of the cache passed to kmem_cache_create.
>
> Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>
>
>
> ---
> Âfs/ext4/mballoc.c | Â 12 ++----------
> Âmm/slab.c     |  Â7 ++++++-
> Â2 files changed, 8 insertions(+), 11 deletions(-)
>
> Index: linux-2.6/fs/ext4/mballoc.c
> ===================================================================
> --- linux-2.6.orig/fs/ext4/mballoc.c  Â2011-02-08 09:02:40.000000000 -0600
> +++ linux-2.6/fs/ext4/mballoc.c 2011-02-08 09:11:16.000000000 -0600
> @@ -2448,15 +2448,10 @@ int ext4_mb_init(struct super_block *sb,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âbb_counters[sb->s_blocksize_bits + 2]);
>
> Â Â Â Â Â Â Â Âsprintf(name, "ext4_groupinfo_%d", sb->s_blocksize_bits);
> - Â Â Â Â Â Â Â namep = kstrdup(name, GFP_KERNEL);
> - Â Â Â Â Â Â Â if (!namep) {
> - Â Â Â Â Â Â Â Â Â Â Â ret = -ENOMEM;
> - Â Â Â Â Â Â Â Â Â Â Â goto out;
> - Â Â Â Â Â Â Â }
>
> Â Â Â Â Â Â Â Â/* Need to free the kmem_cache_name() when we
> Â Â Â Â Â Â Â Â * destroy the slab */
> - Â Â Â Â Â Â Â cachep = kmem_cache_create(namep, len, 0,
> + Â Â Â Â Â Â Â cachep = kmem_cache_create(name, len, 0,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SLAB_RECLAIM_ACCOUNT, NULL);
> Â Â Â Â Â Â Â Âif (!cachep) {
> Â Â Â Â Â Â Â Â Â Â Â Âret = -ENOMEM;
> @@ -2746,11 +2741,8 @@ void ext4_exit_mballoc(void)
>
> Â Â Â Âfor (i = 0; i < NR_GRPINFO_CACHES; i++) {
> Â Â Â Â Â Â Â Âstruct kmem_cache *cachep = ext4_groupinfo_caches[i];
> - Â Â Â Â Â Â Â if (cachep) {
> - Â Â Â Â Â Â Â Â Â Â Â char *name = (char *)kmem_cache_name(cachep);
> + Â Â Â Â Â Â Â if (cachep)
> Â Â Â Â Â Â Â Â Â Â Â Âkmem_cache_destroy(cachep);
> - Â Â Â Â Â Â Â Â Â Â Â kfree(name);
> - Â Â Â Â Â Â Â }
> Â Â Â Â}
> Â Â Â Âext4_remove_debugfs_entry();
> Â}
> Index: linux-2.6/mm/slab.c
> ===================================================================
> --- linux-2.6.orig/mm/slab.c  Â2011-02-08 09:06:38.000000000 -0600
> +++ linux-2.6/mm/slab.c 2011-02-08 09:25:39.000000000 -0600
> @@ -2005,6 +2005,7 @@ static void __kmem_cache_destroy(struct
> Â Â Â Â Â Â Â Â Â Â Â Âkfree(l3);
> Â Â Â Â Â Â Â Â}
> Â Â Â Â}
> + Â Â Â kfree(cachep->name);
> Â Â Â Âkmem_cache_free(&cache_cache, cachep);
> Â}
>
> @@ -2412,7 +2413,11 @@ kmem_cache_create (const char *name, siz
> Â Â Â Â Â Â Â ÂBUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache));
> Â Â Â Â}
> Â Â Â Âcachep->ctor = ctor;
> - Â Â Â cachep->name = name;
> + Â Â Â if (slab_is_available())
> + Â Â Â Â Â Â Â cachep->name = kstrdup(name, GFP_KERNEL);
> + Â Â Â else
> + Â Â Â Â Â Â Â /* Will never be freed so it does not matter */
> + Â Â Â Â Â Â Â cachep->name = name;
>
> Â Â Â Âif (setup_cpu_cache(cachep, gfp)) {
> Â Â Â Â Â Â Â Â__kmem_cache_destroy(cachep);
>

Isn't the fs/ext4 part obsolete by Eric's "ext4: make grpinfo slab
cache names static"?
The mentionned patch is pending in ext4.git#{master, for_linus} [1].

Shouldn't this patch reduced to the mm/slab part?

- Sedat -


[1] http://git.kernel.org/?p=linux/kernel/git/tytso/ext4.git;a=commit;h=11510460562fb3fa1b061ed4d7350ccdc39a984f
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i