From: Al Viro <viro@zeniv.linux.org.uk>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: brauner@kernel.org, jack@suse.cz, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] fs: hide names_cache behind runtime const machinery
Date: Tue, 2 Dec 2025 02:31:47 +0000 [thread overview]
Message-ID: <20251202023147.GA1712166@ZenIV> (raw)
In-Reply-To: <20251201085117.GB3538@ZenIV>
On Mon, Dec 01, 2025 at 08:51:17AM +0000, Al Viro wrote:
> On Mon, Dec 01, 2025 at 09:32:26AM +0100, Mateusz Guzik wrote:
> > s/names_cachep/names_cache/ for consistency with dentry cache.
> >
> > Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
> > ---
> >
> > v2:
> > - rebased on top of work.filename-refcnt
> >
> > ACHTUNG: there is a change queued for 6.19 merge window which treats
> > dentry cache the same way:
> > commit 21b561dab1406e63740ebe240c7b69f19e1bcf58
> > Author: Mateusz Guzik <mjguzik@gmail.com>
> > Date: Wed Nov 5 16:36:22 2025 +0100
> >
> > fs: hide dentry_cache behind runtime const machinery
> >
> > which would result in a merge conflict in vmlinux.lds.h. thus I
> > cherry-picked before generating the diff to avoid the issue for later.
>
> *shrug*
> For now I'm working on top of v6.18; rebase to -rc1 will happen at the
> end of window...
>
> Anyway, not a problem; applied with obvious massage. Will push tomorrow
> once I sort the linearization out.
FWIW, I wonder if we would be better off with the following trick:
add
struct kmem_cache *preallocated;
to struct kmem_cache_args. Semantics: if the value is non-NULL, it must
point to an unitialized object of type struct kmem_cache; in that case
__kmem_cache_create_args() will use that object (and return its address
on success) instead of allocating one from kmem_cache. kmem_cache_destroy()
should not be called for it.
It's very easy to do, AFAICS:
1) non-NULL => have __kmem_cache_create_args() skip the __kmem_cache_alias()
path.
2) non-NULL => have create_cache() zero what it points to and use that pointer
instead of calling kmem_cache_zalloc()
3) non-NULL => skip kmem_cache_free() at create_cache() out_free_cache:
"Don't do kmem_cache_destroy() to those" might or might not be worth relaxing -
I hadn't looked into the lifetime issues for kmem_cache instances, no idea
how painful would that be; for core kernel caches it's not an issue, obviously.
For modules it is, but then runtime_constant machinery is not an option there
either.
next prev parent reply other threads:[~2025-12-02 2:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 8:32 [PATCH v2] fs: hide names_cache behind runtime const machinery Mateusz Guzik
2025-12-01 8:51 ` Al Viro
2025-12-02 2:31 ` Al Viro [this message]
2025-12-02 5:10 ` Mateusz Guzik
2025-12-02 5:52 ` Al Viro
2025-12-02 6:18 ` Mateusz Guzik
2025-12-02 6:32 ` Al Viro
2025-12-02 7:21 ` Al Viro
2025-12-02 6:20 ` Al Viro
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=20251202023147.GA1712166@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.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;
as well as URLs for NNTP newsgroup(s).