From: Harry Yoo <harry@kernel.org>
To: Marco Elver <elver@google.com>,
Vlastimil Babka <vbabka@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: 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>
Subject: Re: [PATCH] slab: silence sparse warning with type-based partitioning
Date: Wed, 22 Jul 2026 16:08:06 +0900 [thread overview]
Message-ID: <9e65f398-5576-48df-85fa-3d993b9e163b@kernel.org> (raw)
In-Reply-To: <20260721092005.1986693-1-elver@google.com>
[-- Attachment #1.1: Type: text/plain, Size: 1635 bytes --]
On 7/21/26 6:19 PM, 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>
> ---
FWIW,
Acked-by: Harry Yoo (Oracle) <harry@kernel.org>
> 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)
--
Cheers,
Harry / Hyeonggon
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-07-22 7:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 9:19 Marco Elver
2026-07-21 9:30 ` Vlastimil Babka (SUSE)
2026-07-22 7:08 ` Harry Yoo [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=9e65f398-5576-48df-85fa-3d993b9e163b@kernel.org \
--to=harry@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=elver@google.com \
--cc=hao.li@linux.dev \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--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
all inboxes | Powered by JetHome®