Re: SLUB: kmem_cache_destroy doesn't - version 2.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Another approach drop the symlinks completely. Just 
write a message to the syslog informing the user that we
created an alias. If debugging is off then the user would have to consult
the syslog to find aliases.


Index: linux-2.6.21-rc6/mm/slub.c
===================================================================
--- linux-2.6.21-rc6.orig/mm/slub.c	2007-04-19 22:46:20.000000000 -0700
+++ linux-2.6.21-rc6/mm/slub.c	2007-04-19 22:48:26.000000000 -0700
@@ -158,11 +158,9 @@ LIST_HEAD(slab_caches);
 
 #ifdef CONFIG_SYSFS
 static int sysfs_slab_add(struct kmem_cache *);
-static int sysfs_slab_alias(struct kmem_cache *, const char *);
 static void sysfs_slab_remove(struct kmem_cache *);
 #else
 static int sysfs_slab_add(struct kmem_cache *s) { return 0; }
-static int sysfs_slab_alias(struct kmem_cache *s, const char *p) { return 0; }
 static void sysfs_slab_remove(struct kmem_cache *s) {}
 #endif
 
@@ -2324,8 +2322,8 @@ struct kmem_cache *kmem_cache_create(con
 		 */
 		s->objsize = max(s->objsize, (int)size);
 		s->inuse = max_t(int, s->inuse, ALIGN(size, sizeof(void *)));
-		if (sysfs_slab_alias(s, name))
-			goto err;
+		printk(KERN_INFO "SLUB: %s is an alias of %s\n",
+							name, s->name);
 	} else {
 		s = kmalloc(kmem_size, GFP_KERNEL);
 		if (s && kmem_cache_open(s, GFP_KERNEL, name,
@@ -3335,37 +3333,6 @@ static void sysfs_slab_remove(struct kme
 	kobject_del(&s->kobj);
 }
 
-/*
- * Need to buffer aliases during bootup until sysfs becomes
- * available lest we loose that information.
- */
-struct saved_alias {
-	struct kmem_cache *s;
-	const char *name;
-	struct saved_alias *next;
-};
-
-struct saved_alias *alias_list;
-
-static int sysfs_slab_alias(struct kmem_cache *s, const char *name)
-{
-	struct saved_alias *al;
-
-	if (slab_state == SYSFS)
-		return sysfs_create_link(&slab_subsys.kset.kobj,
-						&s->kobj, name);
-
-	al = kmalloc(sizeof(struct saved_alias), GFP_KERNEL);
-	if (!al)
-		return -ENOMEM;
-
-	al->s = s;
-	al->name = name;
-	al->next = alias_list;
-	alias_list = al;
-	return 0;
-}
-
 int __init slab_sysfs_init(void)
 {
 	int err;
@@ -3378,15 +3345,6 @@ int __init slab_sysfs_init(void)
 
 	finish_bootstrap();
 
-	while (alias_list) {
-		struct saved_alias *al = alias_list;
-
-		alias_list = alias_list->next;
-		err = sysfs_slab_alias(al->s, al->name);
-		BUG_ON(err);
-		kfree(al);
-	}
-
 	resiliency_test();
 	return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux