mm/slub.c:3330:28: error: implicit declaration of function 'node_nr_objs'; did you mean 'node_nr_slabs'?

From: Naresh Kamboju
Date: Tue Apr 23 2024 - 04:23:54 EST


The arm and mips builds failed due to following warnings / errors with
gcc-13 / gcc-12 and clang-17 on the Linux next-20240423 tag.

Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

arm:
- imx_v6_v7_defconfig
- orion5x_defconfig

mips:
- defconfig
- ath79_defconfig
- bcm63xx_defconfig

In file included from include/linux/export.h:5,
from include/linux/linkage.h:7,
from arch/arm/include/asm/bug.h:5,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:6,
from mm/slub.c:13:
mm/slub.c: In function 'count_partial_free_approx':
mm/slub.c:3330:28: error: implicit declaration of function
'node_nr_objs'; did you mean 'node_nr_slabs'?
[-Werror=implicit-function-declaration]
3330 | x = min(x, node_nr_objs(n));
| ^~~~~~~~~~~~
include/linux/compiler.h:286:55: note: in definition of macro '__is_constexpr'
286 | (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) *
0l)) : (int *)8)))
| ^
include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp'
85 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
mm/slub.c:3330:21: note: in expansion of macro 'min'
3330 | x = min(x, node_nr_objs(n));
| ^~~
In file included from include/linux/init.h:5,
from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/arm/include/asm/bug.h:60:
include/linux/build_bug.h:78:41: error: static assertion failed:
"min(x, node_nr_objs(n)) signedness error, fix types or consider
umin() before min_t()"
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr,
##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
include/linux/minmax.h:51:9: note: in expansion of macro 'static_assert'
51 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:58:17: note: in expansion of macro '__cmp_once'
58 | __cmp_once(op, x, y, __UNIQUE_ID(__x),
__UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:85:25: note: in expansion of macro '__careful_cmp'
85 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
mm/slub.c:3330:21: note: in expansion of macro 'min'
3330 | x = min(x, node_nr_objs(n));
| ^~~
mm/slub.c: At top level:
mm/slub.c:3301:22: warning: 'count_partial_free_approx' defined but
not used [-Wunused-function]
3301 | static unsigned long count_partial_free_approx(struct
kmem_cache_node *n)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Steps to reproduce:
---
# tuxmake --runtime podman --target-arch arm --toolchain gcc-13
--kconfig orion5x_defconfig


Links:
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2fUaQMPe7cZ5qJJOt50avspw7bH/
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240423/testrun/23561861/suite/build/test/gcc-13-orion5x_defconfig/details/

--
Linaro LKFT
https://lkft.linaro.org