[rgushchin:memcontrol_v1.1 5/5] mm/memcontrol-v1.c:1875:48: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list')

kernel test robot
2024-05-07T02:07:47Z

TO: Roman Gushchin <roman.gushchin@linux.dev>

tree: https://github.com/rgushchin/linux.git memcontrol_v1.1
head: 9b269ef160d984dc9ed844151a21384b4ad60fdc
commit: 9b269ef160d984dc9ed844151a21384b4ad60fdc [5/5] mm: memcg: move cgroup v1 interface files to memcontrol-v1.c
config: s390-defconfig (https://download.01.org/0day-ci/archive/20240507/202405071035.tUhz0N6s-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240507/202405071035.tUhz0N6s-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/202405071035.tUhz0N6s-lkp@intel.com/

All warnings (new ones prefixed by >>):

In file included from mm/memcontrol-v1.c:3:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2253:
include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
500 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
501 | item];
| ~~~~
include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
507 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
508 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
519 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
520 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
528 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
529 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from mm/memcontrol-v1.c:10:
include/linux/mm_inline.h:47:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
47 | __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
| ~~~~~~~~~~~ ^ ~~~
include/linux/mm_inline.h:49:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
49 | NR_ZONE_LRU_BASE + lru, nr_pages);
| ~~~~~~~~~~~~~~~~ ^ ~~~
>> mm/memcontrol-v1.c:1875:48: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
1875 | nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
| ~~~~~~~~~~~ ^ ~~~
mm/memcontrol-v1.c:1877:54: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
1877 | nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
| ~~~~~~~~~~~ ^ ~~~
mm/memcontrol-v1.c:1893:46: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
1893 | nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
| ~~~~~~~~~~~ ^ ~~~
mm/memcontrol-v1.c:1895:52: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
1895 | nr += memcg_page_state_local(memcg, NR_LRU_BASE + lru);
| ~~~~~~~~~~~ ^ ~~~
11 warnings generated.

vim +1875 mm/memcontrol-v1.c

1861
1862 static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
1863 int nid, unsigned int lru_mask, bool tree)
1864 {
1865 struct lruvec *lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(nid));
1866 unsigned long nr = 0;
1867 enum lru_list lru;
1868
1869 VM_BUG_ON((unsigned)nid >= nr_node_ids);
1870
1871 for_each_lru(lru) {
1872 if (!(BIT(lru) & lru_mask))
1873 continue;
1874 if (tree)
> 1875 nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
1876 else
1877 nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
1878 }
1879 return nr;
1880 }
1881

--
0-DAY CI Kernel Test Service