Hi Muchun, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.12-rc2 next-20210311] [cannot apply to hnaz-linux-mm/master] [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] url: https://github.com/0day-ci/linux/commits/Muchun-Song/Use-obj_cgroup-APIs-to-charge-kmem-pages/20210309-181121 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 144c79ef33536b4ecb4951e07dbc1f2b7fa99d32 config: i386-randconfig-s002-20210311 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-262-g5e674421-dirty # https://github.com/0day-ci/linux/commit/202c922730a115143cf9e15ab26633f247e00229 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Muchun-Song/Use-obj_cgroup-APIs-to-charge-kmem-pages/20210309-181121 git checkout 202c922730a115143cf9e15ab26633f247e00229 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot "sparse warnings: (new ones prefixed by >>)" mm/memcontrol.c:4194:21: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4194:21: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4194:21: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4196:21: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4196:21: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4196:21: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4352:9: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4352:9: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4352:9: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:4446:9: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:4446:9: sparse: struct mem_cgroup_threshold_ary [noderef] __rcu * mm/memcontrol.c:4446:9: sparse: struct mem_cgroup_threshold_ary * mm/memcontrol.c:6002:23: sparse: sparse: incompatible types in comparison expression (different address spaces): mm/memcontrol.c:6002:23: sparse: struct task_struct [noderef] __rcu * mm/memcontrol.c:6002:23: sparse: struct task_struct * >> mm/memcontrol.c:854:6: sparse: sparse: context imbalance in '__mod_lruvec_page_state' - different lock contexts for basic block mm/memcontrol.c: note: in included file: include/linux/memcontrol.h:707:9: sparse: sparse: context imbalance in 'lock_page_lruvec' - wrong count at exit include/linux/memcontrol.h:707:9: sparse: sparse: context imbalance in 'lock_page_lruvec_irq' - wrong count at exit include/linux/memcontrol.h:707:9: sparse: sparse: context imbalance in 'lock_page_lruvec_irqsave' - wrong count at exit mm/memcontrol.c:2137:19: sparse: sparse: context imbalance in 'lock_page_memcg' - wrong count at exit mm/memcontrol.c:2199:17: sparse: sparse: context imbalance in '__unlock_page_memcg' - unexpected unlock mm/memcontrol.c:5853:28: sparse: sparse: context imbalance in 'mem_cgroup_count_precharge_pte_range' - unexpected unlock mm/memcontrol.c:6047:36: sparse: sparse: context imbalance in 'mem_cgroup_move_charge_pte_range' - unexpected unlock vim +/__mod_lruvec_page_state +854 mm/memcontrol.c eedc4e5a142cc3 Roman Gushchin 2020-08-06 853 c47d5032ed3002 Shakeel Butt 2020-12-14 @854 void __mod_lruvec_page_state(struct page *page, enum node_stat_item idx, c47d5032ed3002 Shakeel Butt 2020-12-14 855 int val) c47d5032ed3002 Shakeel Butt 2020-12-14 856 { c47d5032ed3002 Shakeel Butt 2020-12-14 857 struct page *head = compound_head(page); /* rmap on tail pages */ 286d6cff5d9973 Muchun Song 2021-03-09 858 struct mem_cgroup *memcg; c47d5032ed3002 Shakeel Butt 2020-12-14 859 pg_data_t *pgdat = page_pgdat(page); c47d5032ed3002 Shakeel Butt 2020-12-14 860 struct lruvec *lruvec; c47d5032ed3002 Shakeel Butt 2020-12-14 861 202c922730a115 Muchun Song 2021-03-09 862 if (PageMemcgKmem(head)) { 202c922730a115 Muchun Song 2021-03-09 863 rcu_read_lock(); 202c922730a115 Muchun Song 2021-03-09 864 memcg = obj_cgroup_memcg(page_objcg(page)); 202c922730a115 Muchun Song 2021-03-09 865 } else { 202c922730a115 Muchun Song 2021-03-09 866 memcg = page_memcg(head); 202c922730a115 Muchun Song 2021-03-09 867 /* 202c922730a115 Muchun Song 2021-03-09 868 * Untracked pages have no memcg, no lruvec. Update only the 202c922730a115 Muchun Song 2021-03-09 869 * node. 202c922730a115 Muchun Song 2021-03-09 870 */ d635a69dd4981c Linus Torvalds 2020-12-15 871 if (!memcg) { c47d5032ed3002 Shakeel Butt 2020-12-14 872 __mod_node_page_state(pgdat, idx, val); c47d5032ed3002 Shakeel Butt 2020-12-14 873 return; c47d5032ed3002 Shakeel Butt 2020-12-14 874 } 202c922730a115 Muchun Song 2021-03-09 875 } c47d5032ed3002 Shakeel Butt 2020-12-14 876 d635a69dd4981c Linus Torvalds 2020-12-15 877 lruvec = mem_cgroup_lruvec(memcg, pgdat); c47d5032ed3002 Shakeel Butt 2020-12-14 878 __mod_lruvec_state(lruvec, idx, val); 202c922730a115 Muchun Song 2021-03-09 879 202c922730a115 Muchun Song 2021-03-09 880 if (PageMemcgKmem(head)) 202c922730a115 Muchun Song 2021-03-09 881 rcu_read_unlock(); c47d5032ed3002 Shakeel Butt 2020-12-14 882 } f0c0c115fb8194 Shakeel Butt 2020-12-14 883 EXPORT_SYMBOL(__mod_lruvec_page_state); c47d5032ed3002 Shakeel Butt 2020-12-14 884 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org