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 3/3] mm/slab: drop BUCKET_PARAMS and KMALLOC_PARAMS macros
Date: Mon, 30 Nov 2026 03:56:56 +0000 [thread overview]
Message-ID: <awzv3V3ioGi1SQN6@fedora> (raw)
In-Reply-To: <20261124-kmalloc-entry-rework-v1-3-37b1631a67b5@kernel.org>
On Tue, Nov 24, 2026 at 05:30:04PM +0100, Vlastimil Babka (SUSE) wrote:
> Now that kmem_buckets allocations have their own entry points, we can
> drop the corresponding macros for kmalloc functions. BUCKET_PARAMS can
> be dropped completely and KMALLOC_PARAMS users can use TOKEN_PARAMS for
> handling just the randomization tokens.
>
> Passing hardcoded NULL kmem_buckets pointer to __do_kmalloc_node() is
> cheap because it (and everything that cares about the pointer) is
> inlined.
>
> This has a minor reduction effect on kmalloc_node() family of callers
> not passing the NULL buckets pointer anymore with CONFIG_SLAB_BUCKETS=y,
> as expected.
>
> add/remove: 1/1 grow/shrink: 51/217 up/down: 1316/-1798 (-482)
>
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> ---
> include/linux/slab.h | 37 ++++++++-----------------------------
> mm/slub.c | 19 ++++++++-----------
> 2 files changed, 16 insertions(+), 40 deletions(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 46ecf99f044e..bf6ce52fd105 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -933,27 +933,6 @@ void *kmem_cache_alloc_from_sheaf_noprof(struct kmem_cache *cachep, gfp_t gfp,
>
> unsigned int kmem_cache_sheaf_size(struct slab_sheaf *sheaf);
>
> -/*
> - * These macros allow declaring a kmem_buckets * parameter alongside size, which
> - * can be compiled out with CONFIG_SLAB_BUCKETS=n so that a large number of call
> - * sites don't have to pass NULL.
> - */
> -#ifdef CONFIG_SLAB_BUCKETS
> -#define DECL_BUCKET_PARAMS(_size, _b) size_t (_size), kmem_buckets *(_b)
> -#define PASS_BUCKET_PARAMS(_size, _b) (_size), (_b)
> -#define PASS_BUCKET_PARAM(_b) (_b)
> -#else
> -#define DECL_BUCKET_PARAMS(_size, _b) size_t (_size)
We still have two leftovers:
tools/lib/python/kdoc/xforms_lists.py:95: (CMatch("DECL_BUCKET_PARAMS"), r"\1, \2"),
tools/unittests/test_cmatch.py:351: (CMatch("DECL_BUCKET_PARAMS"), r"\1, \2"),
> -#define PASS_BUCKET_PARAMS(_size, _b) (_size)
> -#define PASS_BUCKET_PARAM(_b) NULL
> -#endif
> -
> -#define DECL_KMALLOC_PARAMS(_size, _b, _token) DECL_BUCKET_PARAMS(_size, _b) \
> - DECL_TOKEN_PARAM(_token)
> -
> -#define PASS_KMALLOC_PARAMS(_size, _b, _token) PASS_BUCKET_PARAMS(_size, _b) \
> - _PASS_TOKEN_PARAM(_token)
> -
--
Thanks,
Hao
prev parent reply other threads:[~2026-11-30 3:57 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
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 [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=awzv3V3ioGi1SQN6@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.