From: David Rientjes <rientjes@google.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
Roman Gushchin <roman.gushchin@linux.dev>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: slub: remove dead and buggy code from sysfs_slab_add()
Date: Sun, 9 Oct 2022 20:54:36 -0700 (PDT) [thread overview]
Message-ID: <48a02db7-f59e-b80b-b879-3fd679623945@google.com> (raw)
In-Reply-To: <20220930084742.771804-1-linux@rasmusvillemoes.dk>
On Fri, 30 Sep 2022, Rasmus Villemoes wrote:
> The function sysfs_slab_add() has two callers:
>
> One is slab_sysfs_init(), which first initializes slab_kset, and only
> when that succeeds sets slab_state to FULL, and then proceeds to call
> sysfs_slab_add() for all previously created slabs.
>
> The other is __kmem_cache_create(), but only after a
>
> if (slab_state <= UP)
> return 0;
>
> check.
>
> So in other words, sysfs_slab_add() is never called without
> slab_kset (aka the return value of cache_kset()) being non-NULL.
>
> And this is just as well, because if we ever did take this path and
> called kobject_init(&s->kobj), and then later when called again from
> slab_sysfs_init() would end up calling kobject_init_and_add(), we
> would hit
>
> if (kobj->state_initialized) {
> /* do not error out as sometimes we can recover */
> pr_err("kobject (%p): tried to init an initialized object, something is seriously wrong.\n",
> dump_stack();
> }
>
> in kobject.c.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: David Rientjes <rientjes@google.com>
next prev parent reply other threads:[~2022-10-10 3:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 8:47 [PATCH] mm: slub: remove dead and buggy code from sysfs_slab_add() Rasmus Villemoes
2022-10-03 7:02 ` Hyeonggon Yoo
2022-10-03 9:38 ` Rasmus Villemoes
2022-10-06 6:20 ` Hyeonggon Yoo
2022-10-10 3:54 ` David Rientjes [this message]
2022-10-14 8:15 ` Vlastimil Babka
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=48a02db7-f59e-b80b-b879-3fd679623945@google.com \
--to=rientjes@google.com \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=penberg@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).