[vbabka-slab:slab/for-next 11/12] mm/slub.c:3227:22: warning: 'count_partial_free_approx' defined but not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: arc-randconfig-001-20240423 (https://download.01.org/0day-ci/archive/20240423/202404231048.ucsxSmAS-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240423/202404231048.ucsxSmAS-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404231048.ucsxSmAS-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from arch/arc/include/asm/ptrace.h:11,
                    from arch/arc/include/asm/bug.h:11,
                    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:3256:28: error: implicit declaration of function 'node_nr_objs'; did you mean 'node_nr_slabs'? [-Werror=implicit-function-declaration]
    3256 |                 x = min(x, node_nr_objs(n));
         |                            ^~~~~~~~~~~~
   include/linux/compiler.h:284:55: note: in definition of macro '__is_constexpr'
     284 |         (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:3256:21: note: in expansion of macro 'min'
    3256 |                 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/arc/include/asm/bug.h:30:
   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:3256:21: note: in expansion of macro 'min'
    3256 |                 x = min(x, node_nr_objs(n));
         |                     ^~~
   mm/slub.c: At top level:
>> mm/slub.c:3227:22: warning: 'count_partial_free_approx' defined but not used [-Wunused-function]
    3227 | static unsigned long count_partial_free_approx(struct kmem_cache_node *n)
         |                      ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/count_partial_free_approx +3227 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux