The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hongling Zeng <zhongling0719@126.com>
To: Harry Yoo <harry@kernel.org>,
	Hongling Zeng <zenghongling@kylinos.cn>,
	 vbabka@kernel.org, akpm@linux-foundation.org, hao.li@linux.dev,
	 cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev,
	 vdavydov.dev@gmail.com, davej@fedoraproject.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add
Date: Mon, 13 Jul 2026 15:45:20 +0800	[thread overview]
Message-ID: <6A549790.3000203@126.com> (raw)
In-Reply-To: <b42f2b3a-68c9-4e3c-b3b7-d940677b4609@kernel.org>


在 2026年07月13日 15:26, Harry Yoo 写道:
> On 7/13/26 4:00 PM, Hongling Zeng wrote:
>> Add a comment to clarify why we don't call kobject_put() when
>> 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@kernel.org>
>> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
>> ---
>>
>>   Change in v1:
>>   -Correct the email
> Hmm, the email "Hyeonggon Kim <pictureone@kakao.com>" came out of
> nowhere. Could you please explain why this happened?
   My apologies for the confusion.

   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;


  reply	other threads:[~2026-07-13  7:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  7:00 [PATCH v1] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add Hongling Zeng
2026-07-13  7:26 ` Harry Yoo
2026-07-13  7:45   ` Hongling Zeng [this message]
2026-07-13  8:49     ` Harry Yoo
2026-07-13 13:54 ` Vlastimil Babka (SUSE)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A549790.3000203@126.com \
    --to=zhongling0719@126.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=davej@fedoraproject.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=vdavydov.dev@gmail.com \
    --cc=zenghongling@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox