From: Hao Li <hao.li@linux.dev>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Harry Yoo <harry@kernel.org>, Chris Down <chris@chrisdown.name>,
Kees Cook <kees@kernel.org>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/slab: add own entry points for kmem_buckets_alloc() family
Date: Mon, 30 Nov 2026 12:03:56 +0000 [thread overview]
Message-ID: <aw1ciiXYI06gegvd@fedora> (raw)
In-Reply-To: <6f13cfd3-29a5-473e-af36-8f7b8ea635f3@kernel.org>
On Mon, Nov 30, 2026 at 09:38:03AM +0100, Vlastimil Babka (SUSE) wrote:
> On 11/30/26 09:31, Vlastimil Babka (SUSE) wrote:
> > On 11/30/26 04:34, Hao Li wrote:
> >> On Tue, Nov 24, 2026 at 05:30:03PM +0100, Vlastimil Babka (SUSE) wrote:
> >>>
> >>> +void *__kmem_buckets_valloc_noprof(kmem_buckets *b, size_t size,
> >>> + unsigned long align, gfp_t flags, int node)
> >>> +{
> >>> + void *ret;
> >>> + const struct slab_alloc_context ac = {
> >>> + .caller_addr = _RET_IP_,
> >>> + .orig_size = size,
> >>> + .alloc_flags = SLAB_ALLOC_DEFAULT,
> >>> + };
> >>> +
> >>> + if (!IS_ENABLED(CONFIG_SLAB_BUCKETS))
> >>> + b = NULL;
> >>> +
> >>> + /*
> >>> + * It doesn't really make sense to fallback to vmalloc for sub page
> >>> + * requests
> >>> + */
> >>> + ret = __do_kmalloc_node(b, kmalloc_gfp_adjust(flags, size),
> >>> + node, (kmalloc_token_t){}, &ac);
> >>> + if (ret || size <= PAGE_SIZE)
> >>> + return ret;
> >>> +
> >>> + return __kvmalloc_fallback(size, align, flags, node,
> >>> + __builtin_return_address(0));
> >>> +}
> >>
> >> It looks like __kmalloc_node_noprof, __kmalloc_node_track_caller_noprof, and
> >> __kvmalloc_node_noprof are exported without any module users.
> >>
> >> Could we unexport them, or do we need to export their counterparts as well for
> >> consistency?
> >
> > We must unexport them before hch notices.
>
> But seriously, also we should be careful. How confident are you e.g. in the
> case of __kmalloc_node_noprof? It can end up called by anything doing
> kmalloc_node() if the size isn't constant, or the compiler fails to
> recognize it as such. But I think there are actually many callers that are
> not constant?
>
Ah, you're right. My brain blanked and I only checked direct calls...
That said, kmem_buckets_create() is also exported while the new
__kmem_buckets_*_noprof() functions aren't exported, so a module could create
buckets but no longer allocate from them. Since no modules use
kmem_buckets_create (I'm more confident about this one :P), do we need to
unexport kmem_buckets_create() before hch notices? ;)
--
Thanks,
Hao
next prev parent reply other threads:[~2026-11-30 12:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 16:30 [PATCH 0/3] kmem_buckets entry point rework Vlastimil Babka (SUSE)
2026-11-24 16:30 ` [PATCH 1/3] mm/slab: add ___do_kmalloc_node() to deduplicate code Vlastimil Babka (SUSE)
2026-11-24 16:30 ` [PATCH 2/3] mm/slab: add own entry points for kmem_buckets_alloc() family Vlastimil Babka (SUSE)
2026-11-26 14:22 ` Harry Yoo
2026-11-26 19:04 ` Vlastimil Babka (SUSE)
2026-11-26 19:59 ` Marco Elver
2026-11-27 13:56 ` Harry Yoo
2026-11-30 3:34 ` Hao Li
2026-11-30 8:31 ` Vlastimil Babka (SUSE)
2026-11-30 8:38 ` Vlastimil Babka (SUSE)
2026-11-30 12:03 ` Hao Li [this message]
2026-11-24 16:30 ` [PATCH 3/3] mm/slab: drop BUCKET_PARAMS and KMALLOC_PARAMS macros Vlastimil Babka (SUSE)
2026-11-30 3:56 ` Hao Li
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=aw1ciiXYI06gegvd@fedora \
--to=hao.li@linux.dev \
--cc=chris@chrisdown.name \
--cc=cl@gentwo.org \
--cc=harry@kernel.org \
--cc=kees@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 \
/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