From: Vlastimil Babka <vbabka@suse.cz>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, Jinjie Ruan <ruanjinjie@huawei.com>,
Liu Shixin <liushixin2@huawei.com>,
Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH v1] mm/slab: Allow cache creation to proceed even if sysfs registration fails
Date: Mon, 4 Nov 2024 10:28:57 +0100 [thread overview]
Message-ID: <03d6865f-7371-4d6e-b586-66f85f838ee0@suse.cz> (raw)
In-Reply-To: <CAB=+i9SaJ=wKZKrPi8zVSDwKj72pB+qV3gQ65mAuWgGeowETAw@mail.gmail.com>
On 11/2/24 15:51, Hyeonggon Yoo wrote:
> On Sat, Nov 2, 2024 at 7:16 PM Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
>>
>> On Sat, Nov 2, 2024 at 7:07 PM Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
>> >
>> > On Sat, Nov 2, 2024 at 5:50 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>> > >
>> > > On 11/2/24 8:18 AM, Hyeonggon Yoo wrote:
>> > > >>
>> > > >> Also here, and simplified to "if (sysfs_slab_add(s)) ... " to avoid dealing
>> > > >> with err.
>> > > >
>> > > > Oh no. err is initialized to -EINVAL, so that will not work as intended.
>> > > > It is causing the following list corruption.
>> > >
>> > > Ooops, right, thanks a lot. Wrongly assumed that a test boot in
>> > > virtme-ng would catch silly mistakes like that. Looks like all caches
>> > > were created with SLAB_STATE < FULL.
>> > >
>> > > Fixed by setting err = 0 before trying sysfs add.
>> >
>> > Thanks!
>> >
>> > Hmm... by the way, why doesn't SLUB update 'err' in the event of an error in
>> > init_cache_random_seq(), init_kmem_cache_nodes(), or alloc_kmem_cache_cpus()?
>> > I may be missing something, but it doesn't seem to handle these errors
>> > properly to me...
>>
>> Oh, it seems like a recent change fc0eac57d08c ("slab: pull kmem_cache_open()
>> into do_kmem_cache_create()") incorrectly pulled kmem_cache_open()?
>>
>> Cc-ing Christian Brauner.
>
> Apologies for the oversight; it slipped my mind. It was actually
> correct after all. :(
Yeah AFAICS that commit didn't change it. But yeah it would make sense to
clean up those init/alloc functions so they all return 0 on success and
error code on failure, and wire that up so allocation failures are -ENOMEM
and not -EINVAL. Probably only some fault injection environments are going
to notice, though.
prev parent reply other threads:[~2024-11-04 9:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 13:08 Hyeonggon Yoo
2024-11-01 13:15 ` Hyeonggon Yoo
2024-11-01 13:58 ` Vlastimil Babka
2024-11-02 7:18 ` Hyeonggon Yoo
2024-11-02 8:53 ` Vlastimil Babka
2024-11-02 10:07 ` Hyeonggon Yoo
2024-11-02 10:16 ` Hyeonggon Yoo
2024-11-02 14:51 ` Hyeonggon Yoo
2024-11-04 9:28 ` Vlastimil Babka [this message]
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=03d6865f-7371-4d6e-b586-66f85f838ee0@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=liushixin2@huawei.com \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=ruanjinjie@huawei.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