Re: [PATCH 3/3] mm: memcontrol: correct the nr_pages parameter type of mem_cgroup_update_lru_size()

From: kernel test robot

Date: Wed Mar 25 2026 - 22:40:47 EST


Hi Qi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on next-20260325]
[cannot apply to trace/for-next linus/master v7.0-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Qi-Zheng/mm-memcontrol-correct-the-type-of-stats_updates-to-unsigned-long/20260325-230337
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/2cf06f9faf51900ce6acbb4740fc60355a2842ed.1774342371.git.zhengqi.arch%40bytedance.com
patch subject: [PATCH 3/3] mm: memcontrol: correct the nr_pages parameter type of mem_cgroup_update_lru_size()
config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260326/202603260338.GfCrsaVO-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260326/202603260338.GfCrsaVO-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/202603260338.GfCrsaVO-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from ./arch/riscv/include/asm/bug.h:90,
from ./include/linux/bug.h:5,
from ./arch/riscv/include/asm/cmpxchg.h:9,
from ./arch/riscv/include/asm/barrier.h:14,
from ./include/linux/list.h:11,
from ./include/linux/cgroup-defs.h:12,
from mm/memcontrol.c:28:
mm/memcontrol.c: In function 'mem_cgroup_update_lru_size':
>> mm/memcontrol.c:1486:17: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long int' [-Wformat=]
1486 | "%s(%p, %d, %d): lru_size %ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1487 | __func__, lruvec, lru, nr_pages, size)) {
| ~~~~~~~~
| |
| long int
./include/asm-generic/bug.h:133:31: note: in definition of macro '__WARN_printf'
133 | __warn_printk(arg); \
| ^~~
./include/linux/once_lite.h:31:25: note: in expansion of macro 'WARN'
31 | func(__VA_ARGS__); \
| ^~~~
./include/asm-generic/bug.h:185:9: note: in expansion of macro 'DO_ONCE_LITE_IF'
185 | DO_ONCE_LITE_IF(condition, WARN, 1, format)
| ^~~~~~~~~~~~~~~
mm/memcontrol.c:1485:13: note: in expansion of macro 'WARN_ONCE'
1485 | if (WARN_ONCE(size < 0,
| ^~~~~~~~~
mm/memcontrol.c:1486:30: note: format string is defined here
1486 | "%s(%p, %d, %d): lru_size %ld\n",
| ~^
| |
| int
| %ld


vim +1486 mm/memcontrol.c

6168d0da2b479ce Alex Shi 2020-12-15 1457
925b7673cce3911 Johannes Weiner 2012-01-12 1458 /**
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1459 * mem_cgroup_update_lru_size - account for adding or removing an lru page
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1460 * @lruvec: mem_cgroup per zone lru vector
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1461 * @lru: index of lru list the page is sitting on
b4536f0c829c858 Michal Hocko 2017-01-10 1462 * @zid: zone id of the accounted pages
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1463 * @nr_pages: positive when adding or negative when removing
925b7673cce3911 Johannes Weiner 2012-01-12 1464 *
ca707239e8a7958 Hugh Dickins 2016-05-19 1465 * This function must be called under lru_lock, just before a page is added
07ca760673088f2 Hugh Dickins 2022-02-14 1466 * to or just after a page is removed from an lru list.
925b7673cce3911 Johannes Weiner 2012-01-12 1467 */
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1468 void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru,
6a3cda9fd4d0f0b Qi Zheng 2026-03-24 1469 int zid, long nr_pages)
08e552c69c6930d KAMEZAWA Hiroyuki 2009-01-07 1470 {
ef8f2327996b5c2 Mel Gorman 2016-07-28 1471 struct mem_cgroup_per_node *mz;
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1472 unsigned long *lru_size;
ca707239e8a7958 Hugh Dickins 2016-05-19 1473 long size;
08e552c69c6930d KAMEZAWA Hiroyuki 2009-01-07 1474
f8d665422603ee1 Hirokazu Takahashi 2009-01-07 1475 if (mem_cgroup_disabled())
08e552c69c6930d KAMEZAWA Hiroyuki 2009-01-07 1476 return;
6d12e2d8ddbe653 KAMEZAWA Hiroyuki 2008-02-07 1477
ef8f2327996b5c2 Mel Gorman 2016-07-28 1478 mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
b4536f0c829c858 Michal Hocko 2017-01-10 1479 lru_size = &mz->lru_zone_size[zid][lru];
ca707239e8a7958 Hugh Dickins 2016-05-19 1480
ca707239e8a7958 Hugh Dickins 2016-05-19 1481 if (nr_pages < 0)
ca707239e8a7958 Hugh Dickins 2016-05-19 1482 *lru_size += nr_pages;
ca707239e8a7958 Hugh Dickins 2016-05-19 1483
ca707239e8a7958 Hugh Dickins 2016-05-19 1484 size = *lru_size;
b4536f0c829c858 Michal Hocko 2017-01-10 1485 if (WARN_ONCE(size < 0,
b4536f0c829c858 Michal Hocko 2017-01-10 @1486 "%s(%p, %d, %d): lru_size %ld\n",
b4536f0c829c858 Michal Hocko 2017-01-10 1487 __func__, lruvec, lru, nr_pages, size)) {
ca707239e8a7958 Hugh Dickins 2016-05-19 1488 VM_BUG_ON(1);
ca707239e8a7958 Hugh Dickins 2016-05-19 1489 *lru_size = 0;
ca707239e8a7958 Hugh Dickins 2016-05-19 1490 }
ca707239e8a7958 Hugh Dickins 2016-05-19 1491
ca707239e8a7958 Hugh Dickins 2016-05-19 1492 if (nr_pages > 0)
fa9add641b1b1c5 Hugh Dickins 2012-05-29 1493 *lru_size += nr_pages;
08e552c69c6930d KAMEZAWA Hiroyuki 2009-01-07 1494 }
544122e5e0ee27d KAMEZAWA Hiroyuki 2009-01-07 1495

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki