On Wed, 13 Jul 2011, David Rientjes wrote: > > > spin_unlock_irqrestore(&n->list_lock, flags); > > > + > > > + list_for_each_entry_safe(page, h, &empty, lru) > > > + discard_slab(s, page); > > > + > > > + if (!list_empty(&n->partial)) > > > + list_for_each_entry(page, &n->partial, lru) > > > + list_slab_objects(s, page, > > > + "Objects remaining on kmem_cache_close()"); > > > } > > > > > > /* > > The last iteration to check for any pages remaining on the partial list is > not safe because partial list manipulation is protected by list_lock. > That needs to be fixed by testing for page->inuse during the iteration > while still holding the lock and dropping the later iteration all > together. At this point no other process can be accessing the slab anymore. No need for the list_lock > > > @@ -2709,9 +2716,9 @@ void kmem_cache_destroy(struct kmem_cach > > > } > > > if (s->flags & SLAB_DESTROY_BY_RCU) > > > rcu_barrier(); > > > - sysfs_slab_remove(s); > > > - } > > > - up_write(&slub_lock); > > > + kfree(s); > > Why the new kfree() here? If the refcount is 0, then this should be > handled when the sysfs entry is released regardless of whether > sysfs_slab_remove() uses the CONFIG_SYSFS variant or not. If kfree(s) > were needed here, we'd be leaking s->name as well. Right. I will fix that. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>