From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Harry Yoo <harry@kernel.org>
Cc: Chris Down <chris@chrisdown.name>, Kees Cook <kees@kernel.org>,
Hao Li <hao.li@linux.dev>, 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,
"Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Subject: [PATCH 0/3] kmem_buckets entry point rework
Date: Tue, 24 Nov 2026 17:30:01 +0100 [thread overview]
Message-ID: <20261124-kmalloc-entry-rework-v1-0-37b1631a67b5@kernel.org> (raw)
When pondering the boot-time slab hardening features patchset [1] it
occured to me that the kmem_buckets handling could be redone in a way
that there are no kmem_buckets pointers in kmalloc_node() and two more
functions, and we can drop some of the tedious parameter declaring and
passing macros (except those for randomizing tokens).
So instead add own entry points for kmem_buckets enabled allocations.
The first patch is a preparatory cleanup that also makes the new entry
points cheaper (in terms of binary size) by making a bet that one extra
call in the allocation fastpath is better than many functions inlining
the same code. If that bet is wrong (I haven't measured it yet) we can
add an inline there (it still removes some duplicated code) and pay the
binary size of the new entry points, but it shouldn't compromise the
whole idea.
If this is accepted, [1] should be rebased on it as it makes the
slab_buckets boot-time handling really straightforward. In fact
CONFIG_SLAB_BUCKETS could be repurposed to only control the default
behavior, while the code is always compiled in.
[1] https://lore.kernel.org/all/cover.1794506262.git.chris@chrisdown.name/
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
---
Vlastimil Babka (SUSE) (3):
mm/slab: add ___do_kmalloc_node() to deduplicate code
mm/slab: add own entry points for kmem_buckets_alloc() family
mm/slab: drop BUCKET_PARAMS and KMALLOC_PARAMS macros
include/linux/slab.h | 53 +++++++-----------
mm/slub.c | 152 ++++++++++++++++++++++++++++++++++++---------------
2 files changed, 128 insertions(+), 77 deletions(-)
---
base-commit: 0b4d8fca3d41123c2419b8e489ea7dba34d5b7e0
change-id: 20261116-kmalloc-entry-rework-a0162912968b
next reply other threads:[~2026-11-24 16:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 16:30 Vlastimil Babka (SUSE) [this message]
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-24 16:30 ` [PATCH 3/3] mm/slab: drop BUCKET_PARAMS and KMALLOC_PARAMS macros 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=20261124-kmalloc-entry-rework-v1-0-37b1631a67b5@kernel.org \
--to=vbabka@kernel.org \
--cc=chris@chrisdown.name \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--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 \
/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
all inboxes | Powered by JetHome®