The patch titled Subject: mm, slub: fix support for clang 10 has been added to the -mm tree. Its filename is mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time-fix-2.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time-fix-2.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time-fix-2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> Subject: mm, slub: fix support for clang 10 Previously in 'commit ff3daafe3fd3 ("mm, slub: change run-time assertion in kmalloc_index() to compile-time")', changed kmalloc_index's run-time assertion to compile-time assertion. But clang 10 has a bug misevaluating __builtin_constant_p() as true, making it unable to compile. This bug was fixed in clang 11. To support clang 10, introduce a macro to do run-time assertion if clang version is less than 11, even if the size is constant. Might revert this commit later if we choose not to support clang 10. Link: https://lkml.kernel.org/r/20210518181247.GA10062@hyeyoo Fixes: ff3daafe3fd3 ("mm, slub: change run-time assertion in kmalloc_index() to compile-time") Link: https://lore.kernel.org/r/CA+G9fYvYxqVhUTkertjZjcrUq8LWPnO7qC==Wum3gYCwWF9D6Q@xxxxxxxxxxxxxx/ Link: https://lkml.org/lkml/2021/5/11/872 Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> Suggested-by: Nathan Chancellor <nathan@xxxxxxxxxx> Signed-off-by: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> Cc: Marco Elver <elver@xxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/slab.h~mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time-fix-2 +++ a/include/linux/slab.h @@ -389,7 +389,7 @@ static __always_inline unsigned int __km if (size <= 16 * 1024 * 1024) return 24; if (size <= 32 * 1024 * 1024) return 25; - if (size_is_constant) + if ((IS_ENABLED(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 110000) && size_is_constant) BUILD_BUG_ON_MSG(1, "unexpected size in kmalloc_index()"); else BUG(); _ Patches currently in -mm which might be from 42.hyeyoo@xxxxxxxxx are mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time.patch mm-slub-change-run-time-assertion-in-kmalloc_index-to-compile-time-fix-2.patch mm-fix-typos-and-grammar-error-in-comments.patch