Re: [PATCH] mm/slab: Fix a kmemleak in kmem_cache_destroy()

Vlastimil Babka
2024-02-28T07:34:04Z

On 2/28/24 04:04, Xiaolei Wang wrote:
> For earlier kmem cache creation, slab_sysfs_init() has not been called.
> Consequently, kmem_cache_destroy() cannot utilize kobj_type::release to
> release the kmem_cache structure. Therefore, tweak kmem_cache_release()
> to use slab_kmem_cache_release() for releasing kmem_cache when slab_state
> isn't FULL. This will fixes the memory leaks like following:

So do I understand correctly the leak happens when a cache is destroyed
while slab_state < FULL? Do we ever destroy a cache that early?