From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Marco Elver <elver@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Chris Li <sparse@chrisli.org>
Cc: Harry Yoo <harry@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,
kasan-dev@googlegroups.com, kernel test robot <lkp@intel.com>,
linux-sparse@vger.kernel.org
Subject: Re: [PATCH] slab: silence sparse warning with type-based partitioning
Date: Tue, 21 Jul 2026 11:30:11 +0200 [thread overview]
Message-ID: <9e399c58-38c7-4c98-b22e-77f04f8b9f5b@kernel.org> (raw)
In-Reply-To: <20260721092005.1986693-1-elver@google.com>
On 7/21/26 11:19, Marco Elver wrote:
> Sparse does not know __builtin_infer_alloc_token() and complains:
>
> sparse: sparse: undefined identifier '__builtin_infer_alloc_token'
>
> Fix it by using a dummy variant of __kmalloc_token() if __CHECKER__ is
> defined.
>
> Fixes: feb662d9168b ("slab: support for compiler-assisted type-based slab cache partitioning")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607110912.nZTqfCrH-lkp@intel.com/
> Signed-off-by: Marco Elver <elver@google.com>
Added to slab/for-next-fixes, thanks!
> ---
> include/linux/slab.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 51f03f18c9a7..7ffe152ce483 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -505,8 +505,12 @@ typedef struct { unsigned long v; } kmalloc_token_t;
> extern unsigned long random_kmalloc_seed;
> #define __kmalloc_token(...) ((kmalloc_token_t){ .v = _CODE_LOCATION_ })
> #elif defined(CONFIG_KMALLOC_PARTITION_TYPED)
> +#ifdef __CHECKER__
> +#define __kmalloc_token(...) ((kmalloc_token_t){ .v = 0 })
> +#else /* !__CHECKER__ */
> #define __kmalloc_token(...) ((kmalloc_token_t){ .v = __builtin_infer_alloc_token(__VA_ARGS__) })
> -#endif
> +#endif /* __CHECKER__ */
> +#endif /* CONFIG_KMALLOC_PARTITION_TYPED */
> #define DECL_TOKEN_PARAM(_token) , kmalloc_token_t (_token)
> #define _PASS_TOKEN_PARAM(_token) , (_token)
> #define PASS_TOKEN_PARAM(_token) (_token)
parent reply other threads:[~2026-07-21 9:30 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260721092005.1986693-1-elver@google.com>]
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=9e399c58-38c7-4c98-b22e-77f04f8b9f5b@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=elver@google.com \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lkp@intel.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=sparse@chrisli.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