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-20 01:10:45.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 @@ -864,7 +862,7 @@ static void __free_slab(struct kmem_cach if (unlikely(PageError(page) || s->dtor)) { void *start = page_address(page); - void *end = start + (pages << PAGE_SHIFT); + void *end = start + (PAGE_SIZE << s->order); void *p; slab_pad_check(s, page); @@ -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; }