SLUB: Extract finish_bootstrap function for clean !SYSFS boot Extract finish_bootstrap function from slab_sysfs_init. We can call that function also if we do not have sysfs defined. This enabled embedded SMP systems to have the periodic 30 second check for unused per cpu slabs. Signed-off-by: Christoph Lameter --- mm/slub.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) Index: linux-2.6.21-rc6/mm/slub.c =================================================================== --- linux-2.6.21-rc6.orig/mm/slub.c 2007-04-12 17:28:03.000000000 -0700 +++ linux-2.6.21-rc6/mm/slub.c 2007-04-12 17:28:43.000000000 -0700 @@ -1716,6 +1716,30 @@ static int calculate_sizes(struct kmem_c } +static int __init finish_bootstrap(void) +{ + struct list_head *h; + int err; + + slab_state = SYSFS; + + list_for_each(h, &slab_caches) { + struct kmem_cache *s = + container_of(h, struct kmem_cache, list); + + err = sysfs_slab_add(s); + BUG_ON(err); + /* + * Start the periodic checks for inactive cpu slabs. + * flush_all() will zero s->cpu_slabs which will cause + * any allocation of a new cpu slab to schedule an event + * via keventd to watch for inactive cpu slabs. + */ + flush_all(s); + } + return 0; +} + static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, const char *name, size_t size, size_t align, unsigned long flags, @@ -3275,7 +3299,6 @@ static int sysfs_slab_alias(struct kmem_ int __init slab_sysfs_init(void) { int err; - struct list_head *h; err = subsystem_register(&slab_subsys); if (err) { @@ -3283,15 +3306,7 @@ int __init slab_sysfs_init(void) return -ENOSYS; } - slab_state = SYSFS; - - list_for_each(h, &slab_caches) { - struct kmem_cache *s = - container_of(h, struct kmem_cache, list); - - err = sysfs_slab_add(s); - BUG_ON(err); - } + finish_bootstrap(); while (alias_list) { struct saved_alias *al = alias_list; @@ -3306,4 +3321,6 @@ int __init slab_sysfs_init(void) } __initcall(slab_sysfs_init); +#else +__initcall(finish_bootstrap); #endif