* [vbabka-slab:slab/for-next 11/12] mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations
@ 2024-04-23 2:21 kernel test robot
2024-04-23 5:06 ` Jianfeng Wang
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-04-23 2:21 UTC (permalink / raw)
To: Jianfeng Wang; +Cc: llvm, oe-kbuild-all, linux-mm, Vlastimil Babka
tree: git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git slab/for-next
head: b6f00c4ef02065161c09fdf560e492cfbb1fec0a
commit: 1c5610f451be71ca2f8b9c6b86ef4712aeed6437 [11/12] slub: introduce count_partial_free_approx()
config: arm-mps2_defconfig (https://download.01.org/0day-ci/archive/20240423/202404231035.P6HbfrHW-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 5ef5eb66fb428aaf61fb51b709f065c069c11242)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240423/202404231035.P6HbfrHW-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404231035.P6HbfrHW-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/slub.c:13:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
3256 | x = min(x, node_nr_objs(n));
| ^
mm/slub.c:3256:14: note: did you mean 'node_nr_slabs'?
mm/slub.c:1862:29: note: 'node_nr_slabs' declared here
1862 | static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
| ^
>> mm/slub.c:3256:7: error: static assertion failed due to requirement '__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) || __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) || (__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)(x) * 0L)) : (int *)8))) && __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0), x, -1) >= 0) || (__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)(node_nr_objs(n)) * 0L)) : (int *)8))) && __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0), node_nr_objs(n), -1) >= 0)': min(x, node_nr_objs(n)) signedness error, fix types or consider umin() before min_t()
3256 | x = min(x, node_nr_objs(n));
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:85:19: note: expanded from macro 'min'
85 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:58:3: note: expanded from macro '__careful_cmp'
58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:51:16: note: expanded from macro '__cmp_once'
51 | static_assert(__types_ok(x, y), \
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 | #op "(" #x ", " #y ") signedness error, fix types or consider u" #op "() before " #op "_t()"); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/minmax.h:31:2: note: expanded from macro '__is_signed'
31 | __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \
| ^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
1 warning and 2 errors generated.
vim +/node_nr_objs +3256 mm/slub.c
3226
3227 static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
3228 {
3229 unsigned long flags;
3230 unsigned long x = 0;
3231 struct slab *slab;
3232
3233 spin_lock_irqsave(&n->list_lock, flags);
3234 if (n->nr_partial <= MAX_PARTIAL_TO_SCAN) {
3235 list_for_each_entry(slab, &n->partial, slab_list)
3236 x += slab->objects - slab->inuse;
3237 } else {
3238 /*
3239 * For a long list, approximate the total count of objects in
3240 * it to meet the limit on the number of slabs to scan.
3241 * Scan from both the list's head and tail for better accuracy.
3242 */
3243 unsigned long scanned = 0;
3244
3245 list_for_each_entry(slab, &n->partial, slab_list) {
3246 x += slab->objects - slab->inuse;
3247 if (++scanned == MAX_PARTIAL_TO_SCAN / 2)
3248 break;
3249 }
3250 list_for_each_entry_reverse(slab, &n->partial, slab_list) {
3251 x += slab->objects - slab->inuse;
3252 if (++scanned == MAX_PARTIAL_TO_SCAN)
3253 break;
3254 }
3255 x = mult_frac(x, n->nr_partial, scanned);
> 3256 x = min(x, node_nr_objs(n));
3257 }
3258 spin_unlock_irqrestore(&n->list_lock, flags);
3259 return x;
3260 }
3261
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* [vbabka-slab:slab/for-next 11/12] mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations
2024-04-23 2:21 [vbabka-slab:slab/for-next 11/12] mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2024-04-23 5:06 ` Jianfeng Wang
0 siblings, 0 replies; 2+ messages in thread
From: Jianfeng Wang @ 2024-04-23 5:06 UTC (permalink / raw)
To: Vlastimil Babka; +Cc: llvm, oe-kbuild-all, linux-mm
On 4/22/24 7:21 PM, kernel test robot wrote:
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git slab/for-next
> head: b6f00c4ef02065161c09fdf560e492cfbb1fec0a
> commit: 1c5610f451be71ca2f8b9c6b86ef4712aeed6437 [11/12] slub: introduce count_partial_free_approx()
> config: arm-mps2_defconfig (https://urldefense.com/v3/__https://download.01.org/0day-ci/archive/20240423/202404231035.P6HbfrHW-lkp@intel.com/config__;!!ACWV5N9M2RV99hQ!OME34mL_ADYQENhnXxNwsh7RcI01QQqhK9FJsBEMMQaQVDaJM3wclQX94a6zSFnvxan0Qx-_wzC34V4$ )
> compiler: clang version 19.0.0git (https://urldefense.com/v3/__https://github.com/llvm/llvm-project__;!!ACWV5N9M2RV99hQ!OME34mL_ADYQENhnXxNwsh7RcI01QQqhK9FJsBEMMQaQVDaJM3wclQX94a6zSFnvxan0Qx-_bxtcvFE$ 5ef5eb66fb428aaf61fb51b709f065c069c11242)
> reproduce (this is a W=1 build): (https://urldefense.com/v3/__https://download.01.org/0day-ci/archive/20240423/202404231035.P6HbfrHW-lkp@intel.com/reproduce__;!!ACWV5N9M2RV99hQ!OME34mL_ADYQENhnXxNwsh7RcI01QQqhK9FJsBEMMQaQVDaJM3wclQX94a6zSFnvxan0Qx-_K2OZqIs$ )
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://urldefense.com/v3/__https://lore.kernel.org/oe-kbuild-all/202404231035.P6HbfrHW-lkp@intel.com/__;!!ACWV5N9M2RV99hQ!OME34mL_ADYQENhnXxNwsh7RcI01QQqhK9FJsBEMMQaQVDaJM3wclQX94a6zSFnvxan0Qx-_gVX_avo$
>
> All errors (new ones prefixed by >>):
>
> In file included from mm/slub.c:13:
> In file included from include/linux/mm.h:2208:
> include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
> 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
> | ~~~~~~~~~~~ ^ ~~~
>>> mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 3256 | x = min(x, node_nr_objs(n));
> | ^
> mm/slub.c:3256:14: note: did you mean 'node_nr_slabs'?
I'm sorry that I didn't catch this when I submitted.
For the v3 patchset, I placed this new function under
"#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)".
However, this causes problems: (1) node_nr_objs() is defined under
CONFIG_SLUB_DEBUG; (2) count_partial_free_approx() is only used under
CONFIG_SLUB_DEBUG. So, if CONFIG_SLUB_DEBUG is not set and
SLAB_SUPPORTS_SYSFS is set, the compilation will fail.
I've submitted a v4 that moves count_partial_free_approx() under
CONFIG_SLUB_DEBUG only, as it is not used in sysfs. Only the first patch is modified.
Here is the link:
https://lore.kernel.org/linux-mm/20240423045554.15045-1-jianfeng.w.wang@oracle.com/T/#t
> mm/slub.c:1862:29: note: 'node_nr_slabs' declared here
> 1862 | static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
> | ^
>>> mm/slub.c:3256:7: error: static assertion failed due to requirement '__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) || __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0) == __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0) || (__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)(x) * 0L)) : (int *)8))) && __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((unsigned long)(-1)) < (unsigned long)1)) * 0L)) : (int *)8))), (((unsigned long)(-1)) < (unsigned long)1), 0), x, -1) >= 0) || (__builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)(node_nr_objs(n)) * 0L)) : (int *)8))) && __builtin_choose_expr((sizeof(int) == sizeof (*(8 ? ((void *)((long)((((int)(-1)) < (int)1)) * 0L)) : (int *)8))), (((int)(-1)) < (int)1), 0), node_nr_objs(n), -1) >= 0)': min(x, node_nr_objs(n)) signedness error, fix types or consider umin() before min_t()
> 3256 | x = min(x, node_nr_objs(n));
> | ^~~~~~~~~~~~~~~~~~~~~~~
> include/linux/minmax.h:85:19: note: expanded from macro 'min'
> 85 | #define min(x, y) __careful_cmp(min, x, y)
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/minmax.h:58:3: note: expanded from macro '__careful_cmp'
> 58 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/minmax.h:51:16: note: expanded from macro '__cmp_once'
> 51 | static_assert(__types_ok(x, y), \
> | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 52 | #op "(" #x ", " #y ") signedness error, fix types or consider u" #op "() before " #op "_t()"); \
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
> include/linux/minmax.h:31:2: note: expanded from macro '__is_signed'
> 31 | __builtin_choose_expr(__is_constexpr(is_signed_type(typeof(x))), \
> | ^
> include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> | ^~~~
> 1 warning and 2 errors generated.
>
>
> vim +/node_nr_objs +3256 mm/slub.c
>
> 3226
> 3227 static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
> 3228 {
> 3229 unsigned long flags;
> 3230 unsigned long x = 0;
> 3231 struct slab *slab;
> 3232
> 3233 spin_lock_irqsave(&n->list_lock, flags);
> 3234 if (n->nr_partial <= MAX_PARTIAL_TO_SCAN) {
> 3235 list_for_each_entry(slab, &n->partial, slab_list)
> 3236 x += slab->objects - slab->inuse;
> 3237 } else {
> 3238 /*
> 3239 * For a long list, approximate the total count of objects in
> 3240 * it to meet the limit on the number of slabs to scan.
> 3241 * Scan from both the list's head and tail for better accuracy.
> 3242 */
> 3243 unsigned long scanned = 0;
> 3244
> 3245 list_for_each_entry(slab, &n->partial, slab_list) {
> 3246 x += slab->objects - slab->inuse;
> 3247 if (++scanned == MAX_PARTIAL_TO_SCAN / 2)
> 3248 break;
> 3249 }
> 3250 list_for_each_entry_reverse(slab, &n->partial, slab_list) {
> 3251 x += slab->objects - slab->inuse;
> 3252 if (++scanned == MAX_PARTIAL_TO_SCAN)
> 3253 break;
> 3254 }
> 3255 x = mult_frac(x, n->nr_partial, scanned);
>> 3256 x = min(x, node_nr_objs(n));
> 3257 }
> 3258 spin_unlock_irqrestore(&n->list_lock, flags);
> 3259 return x;
> 3260 }
> 3261
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-23 5:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 2:21 [vbabka-slab:slab/for-next 11/12] mm/slub.c:3256:14: error: call to undeclared function 'node_nr_objs'; ISO C99 and later do not support implicit function declarations kernel test robot
2024-04-23 5:06 ` Jianfeng Wang
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.