On Tue, 14 Sep 2010, Pekka Enberg wrote:I can put it in mm/slub.c but I was worried about someone reusing the bit for something else.
diff --git a/include/linux/slab.h b/include/linux/slab.hPut this into mm/slub.c as slub only flag? What is the difference from
index 59260e2..df201cf 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -76,6 +76,8 @@
# define SLAB_FAILSLAB 0x00000000UL
#endif
+#define SLAB_DYNAMIC_NAME 0x04000000UL /* s->name is kmalloc()'d */
+
refcount == 1?
I tried that. It gets very nasty during bootstrap.@@ -3218,6 +3221,18 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,Ok. Keeping the original name. Why dont we do strdup by default and always
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);
do a kfree(s->name) on close?