All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [rgushchin:memcontrol_v1.rfc 4/10] mm/memcontrol-v1.c:1109:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
Date: Fri, 10 May 2024 05:14:37 +0800	[thread overview]
Message-ID: <202405100515.D644UVCg-lkp@intel.com> (raw)

tree:   https://github.com/rgushchin/linux.git memcontrol_v1.rfc
head:   0011ac60f32b91542b15b122087bd97f41634b51
commit: bb7dddcd85b885a163916d548d1907c89771fd67 [4/10] mm: memcg: move charge migration code to memcontrol-v1.c
config: i386-randconfig-061-20240510 (https://download.01.org/0day-ci/archive/20240510/202405100515.D644UVCg-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240510/202405100515.D644UVCg-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/202405100515.D644UVCg-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> mm/memcontrol-v1.c:1109:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol-v1.c:1109:23: sparse:    struct task_struct [noderef] __rcu *
   mm/memcontrol-v1.c:1109:23: sparse:    struct task_struct *
   mm/memcontrol-v1.c:417:6: sparse: sparse: context imbalance in 'folio_memcg_lock' - wrong count at exit
   mm/memcontrol-v1.c:464:17: sparse: sparse: context imbalance in '__folio_memcg_unlock' - unexpected unlock
   mm/memcontrol-v1.c: note: in included file (through include/linux/rculist.h, include/linux/cgroup.h, include/linux/memcontrol.h):
   include/linux/rcupdate.h:812:9: sparse: sparse: context imbalance in 'mem_cgroup_count_precharge_pte_range' - unexpected unlock
   include/linux/rcupdate.h:812:9: sparse: sparse: context imbalance in 'mem_cgroup_move_charge_pte_range' - unexpected unlock

vim +1109 mm/memcontrol-v1.c

  1062	
  1063	int mem_cgroup_can_attach(struct cgroup_taskset *tset)
  1064	{
  1065		struct cgroup_subsys_state *css;
  1066		struct mem_cgroup *memcg = NULL; /* unneeded init to make gcc happy */
  1067		struct mem_cgroup *from;
  1068		struct task_struct *leader, *p;
  1069		struct mm_struct *mm;
  1070		unsigned long move_flags;
  1071		int ret = 0;
  1072	
  1073		/* charge immigration isn't supported on the default hierarchy */
  1074		if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
  1075			return 0;
  1076	
  1077		/*
  1078		 * Multi-process migrations only happen on the default hierarchy
  1079		 * where charge immigration is not used.  Perform charge
  1080		 * immigration if @tset contains a leader and whine if there are
  1081		 * multiple.
  1082		 */
  1083		p = NULL;
  1084		cgroup_taskset_for_each_leader(leader, css, tset) {
  1085			WARN_ON_ONCE(p);
  1086			p = leader;
  1087			memcg = mem_cgroup_from_css(css);
  1088		}
  1089		if (!p)
  1090			return 0;
  1091	
  1092		/*
  1093		 * We are now committed to this value whatever it is. Changes in this
  1094		 * tunable will only affect upcoming migrations, not the current one.
  1095		 * So we need to save it, and keep it going.
  1096		 */
  1097		move_flags = READ_ONCE(memcg->move_charge_at_immigrate);
  1098		if (!move_flags)
  1099			return 0;
  1100	
  1101		from = mem_cgroup_from_task(p);
  1102	
  1103		VM_BUG_ON(from == memcg);
  1104	
  1105		mm = get_task_mm(p);
  1106		if (!mm)
  1107			return 0;
  1108		/* We move charges only when we move a owner of the mm */
> 1109		if (mm->owner == p) {
  1110			VM_BUG_ON(mc.from);
  1111			VM_BUG_ON(mc.to);
  1112			VM_BUG_ON(mc.precharge);
  1113			VM_BUG_ON(mc.moved_charge);
  1114			VM_BUG_ON(mc.moved_swap);
  1115	
  1116			spin_lock(&mc.lock);
  1117			mc.mm = mm;
  1118			mc.from = from;
  1119			mc.to = memcg;
  1120			mc.flags = move_flags;
  1121			spin_unlock(&mc.lock);
  1122			/* We set mc.moving_task later */
  1123	
  1124			ret = mem_cgroup_precharge_mc(mm);
  1125			if (ret)
  1126				mem_cgroup_clear_mc();
  1127		} else {
  1128			mmput(mm);
  1129		}
  1130		return ret;
  1131	}
  1132	

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

                 reply	other threads:[~2024-05-09 21:15 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=202405100515.D644UVCg-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=roman.gushchin@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.