On Wed, 23 May 2012, JoonSoo Kim wrote: > 2012/5/19 Christoph Lameter : > > Move the mutex handling into the common kmem_cache_create() > > function. > > > >                        list_add(&s->list, &slab_caches); > >                        mutex_unlock(&slab_mutex); > > -                       if (sysfs_slab_add(s)) { > > -                               mutex_lock(&slab_mutex); > > -                               list_del(&s->list); > > -                               kfree(n); > > -                               kfree(s); > > -                               goto err; > > -                       } > > -                       return s; > > +                       r = sysfs_slab_add(s); > > +                       mutex_lock(&slab_mutex); > > + > > +                       if (!r) > > +                               return s; > > + > > +                       list_del(&s->list); > > +                       kmem_cache_close(s); > >                } > > -               kfree(n); > >                kfree(s); > >        } > > Before this patch is applied, can we move calling 'sysfs_slab_add' to > common code > for removing slab_mutex entirely in kmem_cache_create? Hmmm... its difficult to do that before this patch since sysfs_slab_add requires dropping the mutex.