Comment 11 for bug 1894780

Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

After reverting commit 79ffe7107b13042c69c4a06394175362121b06b5 (upstream commit d38a2b7a9c939e6d7329ab92b96559ccebf7b135) ("mm: memcg/slab: fix memory leak at non-root kmem_cache destroy"), things seem to go back to normal.

The probable reason this one causes a problem is because it has:

@@ -326,6 +326,14 @@ int slab_unmergeable(struct kmem_cache *s)
        if (s->refcount < 0)
                return 1;

+#ifdef CONFIG_MEMCG_KMEM
+ /*
+ * Skip the dying kmem_cache.
+ */
+ if (s->memcg_params.dying)
+ return 1;
+#endif
+
        return 0;
 }

So, this causes the same-sized slab to become unmergeable, and when a new slab is created, it will fail creating the sysfs entry.

I haven't investigated why memcg is at play here, and why this one would be dying, that would involve memcgs being removed during the operation. But not allowing merges will certainly cause problems here.

The other issue is that this memcg code has been totally replaced/discarded on 5.9, so it will make things interesting trying to upstream a proper fix here.

But considering the commit fix a leak and here we will have a different leak and failures to create slabs, the revert is preferable for now.

Cascardo.