Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: 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, zhongling0719@126.com
Subject: Re: [PATCH v1] mm/slub: add comment explaining intentional kobject handling in sysfs_slab_add
Date: Mon, 13 Jul 2026 16:26:59 +0900	[thread overview]
Message-ID: <b42f2b3a-68c9-4e3c-b3b7-d940677b4609@kernel.org> (raw)
In-Reply-To: <20260713070024.153552-1-zenghongling@kylinos.cn>


[-- Attachment #1.1: Type: text/plain, Size: 1382 bytes --]

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?

> ---
>  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;
-- 
Cheers,
Harry / Hyeonggon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-07-13  7:27 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 [this message]
2026-07-13  7:45   ` Hongling Zeng
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=b42f2b3a-68c9-4e3c-b3b7-d940677b4609@kernel.org \
    --to=harry@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=davej@fedoraproject.org \
    --cc=hao.li@linux.dev \
    --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 \
    --cc=zhongling0719@126.com \
    /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