linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jianfeng Wang <jianfeng.w.wang@oracle.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-mm@kvack.org,
	Vlastimil Babka <vbabka@suse.cz>
Subject: [vbabka-slab:slab/for-next 11/12] mm/slub.c:3227:22: warning: 'count_partial_free_approx' defined but not used
Date: Tue, 23 Apr 2024 10:31:31 +0800	[thread overview]
Message-ID: <202404231048.ucsxSmAS-lkp@intel.com> (raw)

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@intel.com/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@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/202404231048.ucsxSmAS-lkp@intel.com/

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


                 reply	other threads:[~2024-04-23  2:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202404231048.ucsxSmAS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jianfeng.w.wang@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=vbabka@suse.cz \
    /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