Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kmem_buckets entry point rework
@ 2026-11-24 16:30 Vlastimil Babka (SUSE)
  2026-11-24 16:30 ` [PATCH 1/3] mm/slab: add ___do_kmalloc_node() to deduplicate code Vlastimil Babka (SUSE)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-11-24 16:30 UTC (permalink / raw)
  To: Harry Yoo
  Cc: Chris Down, Kees Cook, Hao Li, Christoph Lameter, David Rientjes,
	Roman Gushchin, linux-mm, linux-kernel, Vlastimil Babka (SUSE)

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-24 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-24 16:30 ` [PATCH 3/3] mm/slab: drop BUCKET_PARAMS and KMALLOC_PARAMS macros Vlastimil Babka (SUSE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox