Re: [PATCH v1] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add
From: Hongling Zeng
Date: Mon Jul 13 2026 - 03:52:18 EST
在 2026年07月13日 15:26, Harry Yoo 写道:
On 7/13/26 4:00 PM, Hongling Zeng wrote:My apologies for the confusion.
Add a comment to clarify why we don't call kobject_put() whenHmm, the email "Hyeonggon Kim <pictureone@xxxxxxxxx>" came out of
kobject_init_and_add() fails in sysfs_slab_add().
Per commit 2420baa8e046 ("mm/slab: Allow cache creation to proceed
even if sysfs registration fails"), sysfs failures are treated as
non-fatal and the cache continues to be used. Calling kobject_put()
would trigger slab_kmem_cache_release() which frees the entire
cache structure, so we intentionally skip it.
Suggested-by: Harry Yoo <harry@xxxxxxxxxx>
Signed-off-by: Hongling Zeng <zenghongling@xxxxxxxxxx>
---
Change in v1:
-Correct the email
nowhere. Could you please explain why this happened?
I incorrectly retrieved your email from a signature search :)
---
mm/slub.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/slub.c b/mm/slub.c
index 9ec774dc7009..edc822d7d9ea 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -9690,6 +9690,11 @@ static int sysfs_slab_add(struct kmem_cache *s)
s->kobj.kset = kset;
err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name);
+ /*
+ * Intentionally skip kobject_put(). See commit 2420baa8e046
+ * ("mm/slab: Allow cache creation to proceed even if sysfs
+ * registration fails")
+ */
if (err)
goto out;