linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Muchun Song <songmuchun@bytedance.com>,
	guro@fb.com, hannes@cmpxchg.org, mhocko@kernel.org,
	akpm@linux-foundation.org, shakeelb@google.com,
	vdavydov.dev@gmail.com
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, duanxiongchun@bytedance.com,
	fam.zheng@bytedance.com
Subject: Re: [PATCH v1 09/12] mm: memcontrol: use obj_cgroup APIs to charge the LRU pages
Date: Sat, 14 Aug 2021 22:08:18 +0800	[thread overview]
Message-ID: <202108142246.xw9LO9ry-lkp@intel.com> (raw)
In-Reply-To: <20210814052519.86679-10-songmuchun@bytedance.com>

[-- Attachment #1: Type: text/plain, Size: 8640 bytes --]

Hi Muchun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20210813]
[cannot apply to hnaz-linux-mm/master cgroup/for-next linus/master v5.14-rc5 v5.14-rc4 v5.14-rc3 v5.14-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]

url:    https://github.com/0day-ci/linux/commits/Muchun-Song/Use-obj_cgroup-APIs-to-charge-the-LRU-pages/20210814-132844
base:    4b358aabb93a2c654cd1dcab1a25a589f6e2b153
config: i386-randconfig-s032-20210814 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-348-gf0e6938b-dirty
        # https://github.com/0day-ci/linux/commit/33aa30f8c508696b533f8817a5212d6efdd424bb
        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-the-LRU-pages/20210814-132844
        git checkout 33aa30f8c508696b533f8817a5212d6efdd424bb
        # 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 <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   mm/memcontrol.c:4231:21: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol.c:4231:21: sparse:    struct mem_cgroup_threshold_ary [noderef] __rcu *
   mm/memcontrol.c:4231:21: sparse:    struct mem_cgroup_threshold_ary *
   mm/memcontrol.c:4233:21: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol.c:4233:21: sparse:    struct mem_cgroup_threshold_ary [noderef] __rcu *
   mm/memcontrol.c:4233:21: sparse:    struct mem_cgroup_threshold_ary *
   mm/memcontrol.c:4389:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol.c:4389:9: sparse:    struct mem_cgroup_threshold_ary [noderef] __rcu *
   mm/memcontrol.c:4389:9: sparse:    struct mem_cgroup_threshold_ary *
   mm/memcontrol.c:4483:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol.c:4483:9: sparse:    struct mem_cgroup_threshold_ary [noderef] __rcu *
   mm/memcontrol.c:4483:9: sparse:    struct mem_cgroup_threshold_ary *
>> mm/memcontrol.c:5836:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct obj_cgroup *objcg @@     got struct obj_cgroup [noderef] __rcu *objcg @@
   mm/memcontrol.c:5837:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct obj_cgroup *objcg @@     got struct obj_cgroup [noderef] __rcu *objcg @@
   mm/memcontrol.c:6133:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
   mm/memcontrol.c:6133:23: sparse:    struct task_struct [noderef] __rcu *
   mm/memcontrol.c:6133:23: sparse:    struct task_struct *
   mm/memcontrol.c: note: in included file:
   include/linux/memcontrol.h:780:9: sparse: sparse: context imbalance in 'memcg_reparent_lruvec_lock' - wrong count at exit
   include/linux/memcontrol.h:780:9: sparse: sparse: context imbalance in 'memcg_reparent_lruvec_unlock' - unexpected unlock
   mm/memcontrol.c: note: in included file (through include/linux/rculist.h, include/linux/pid.h, include/linux/sched.h, ...):
   include/linux/rcupdate.h:718:9: sparse: sparse: context imbalance in 'folio_lruvec_lock' - wrong count at exit
   include/linux/rcupdate.h:718:9: sparse: sparse: context imbalance in 'folio_lruvec_lock_irq' - wrong count at exit
   include/linux/rcupdate.h:718:9: sparse: sparse: context imbalance in 'folio_lruvec_lock_irqsave' - wrong count at exit
   mm/memcontrol.c:2098:6: sparse: sparse: context imbalance in 'folio_memcg_lock' - wrong count at exit
   mm/memcontrol.c:2154:17: sparse: sparse: context imbalance in '__folio_memcg_unlock' - unexpected unlock

vim +5836 mm/memcontrol.c

  5733	
  5734	/**
  5735	 * mem_cgroup_move_account - move account of the page
  5736	 * @page: the page
  5737	 * @compound: charge the page as compound or small page
  5738	 * @from: mem_cgroup which the page is moved from.
  5739	 * @to:	mem_cgroup which the page is moved to. @from != @to.
  5740	 *
  5741	 * The caller must make sure the page is not on LRU (isolate_page() is useful.)
  5742	 *
  5743	 * This function doesn't do "charge" to new cgroup and doesn't do "uncharge"
  5744	 * from old cgroup.
  5745	 */
  5746	static int mem_cgroup_move_account(struct page *page,
  5747					   bool compound,
  5748					   struct mem_cgroup *from,
  5749					   struct mem_cgroup *to)
  5750	{
  5751		struct folio *folio = page_folio(page);
  5752		struct lruvec *from_vec, *to_vec;
  5753		struct pglist_data *pgdat;
  5754		unsigned int nr_pages = compound ? folio_nr_pages(folio) : 1;
  5755		int nid, ret;
  5756	
  5757		VM_BUG_ON(from == to);
  5758		VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
  5759		VM_BUG_ON(compound && !folio_test_multi(folio));
  5760	
  5761		/*
  5762		 * Prevent mem_cgroup_migrate() from looking at
  5763		 * page's memory cgroup of its source page while we change it.
  5764		 */
  5765		ret = -EBUSY;
  5766		if (!folio_trylock(folio))
  5767			goto out;
  5768	
  5769		ret = -EINVAL;
  5770		if (folio_memcg(folio) != from)
  5771			goto out_unlock;
  5772	
  5773		pgdat = folio_pgdat(folio);
  5774		from_vec = mem_cgroup_lruvec(from, pgdat);
  5775		to_vec = mem_cgroup_lruvec(to, pgdat);
  5776	
  5777		folio_memcg_lock(folio);
  5778	
  5779		if (folio_test_anon(folio)) {
  5780			if (folio_mapped(folio)) {
  5781				__mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages);
  5782				__mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages);
  5783				if (folio_test_transhuge(folio)) {
  5784					__mod_lruvec_state(from_vec, NR_ANON_THPS,
  5785							   -nr_pages);
  5786					__mod_lruvec_state(to_vec, NR_ANON_THPS,
  5787							   nr_pages);
  5788				}
  5789			}
  5790		} else {
  5791			__mod_lruvec_state(from_vec, NR_FILE_PAGES, -nr_pages);
  5792			__mod_lruvec_state(to_vec, NR_FILE_PAGES, nr_pages);
  5793	
  5794			if (folio_test_swapbacked(folio)) {
  5795				__mod_lruvec_state(from_vec, NR_SHMEM, -nr_pages);
  5796				__mod_lruvec_state(to_vec, NR_SHMEM, nr_pages);
  5797			}
  5798	
  5799			if (folio_mapped(folio)) {
  5800				__mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages);
  5801				__mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages);
  5802			}
  5803	
  5804			if (folio_test_dirty(folio)) {
  5805				struct address_space *mapping = folio_mapping(folio);
  5806	
  5807				if (mapping_can_writeback(mapping)) {
  5808					__mod_lruvec_state(from_vec, NR_FILE_DIRTY,
  5809							   -nr_pages);
  5810					__mod_lruvec_state(to_vec, NR_FILE_DIRTY,
  5811							   nr_pages);
  5812				}
  5813			}
  5814		}
  5815	
  5816		if (folio_test_writeback(folio)) {
  5817			__mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages);
  5818			__mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages);
  5819		}
  5820	
  5821		/*
  5822		 * All state has been migrated, let's switch to the new memcg.
  5823		 *
  5824		 * It is safe to change page's memcg here because the page
  5825		 * is referenced, charged, isolated, and locked: we can't race
  5826		 * with (un)charging, migration, LRU putback, or anything else
  5827		 * that would rely on a stable page's memory cgroup.
  5828		 *
  5829		 * Note that lock_page_memcg is a memcg lock, not a page lock,
  5830		 * to save space. As soon as we switch page's memory cgroup to a
  5831		 * new memcg that isn't locked, the above state can change
  5832		 * concurrently again. Make sure we're truly done with it.
  5833		 */
  5834		smp_mb();
  5835	
> 5836		obj_cgroup_get(to->objcg);
  5837		obj_cgroup_put(from->objcg);
  5838	
  5839		folio->memcg_data = (unsigned long)to->objcg;
  5840	
  5841		__folio_memcg_unlock(from);
  5842	
  5843		ret = 0;
  5844		nid = folio_nid(folio);
  5845	
  5846		local_irq_disable();
  5847		mem_cgroup_charge_statistics(to, nr_pages);
  5848		memcg_check_events(to, nid);
  5849		mem_cgroup_charge_statistics(from, -nr_pages);
  5850		memcg_check_events(from, nid);
  5851		local_irq_enable();
  5852	out_unlock:
  5853		folio_unlock(folio);
  5854	out:
  5855		return ret;
  5856	}
  5857	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37476 bytes --]

  reply	other threads:[~2021-08-14 14:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14  5:25 [PATCH v1 00/12] Use obj_cgroup APIs to charge the LRU pages Muchun Song
2021-08-14  5:25 ` [PATCH v1 01/12] mm: memcontrol: prepare objcg API for non-kmem usage Muchun Song
2021-08-14 22:23   ` kernel test robot
2021-08-18  3:01   ` Roman Gushchin
2021-08-20  6:44     ` Muchun Song
2021-08-14  5:25 ` [PATCH v1 02/12] mm: memcontrol: introduce compact_folio_lruvec_lock_irqsave Muchun Song
2021-08-14  5:25 ` [PATCH v1 03/12] mm: memcontrol: make lruvec lock safe when LRU pages are reparented Muchun Song
2021-08-18  3:18   ` Roman Gushchin
2021-08-18  4:28     ` Muchun Song
2021-08-18  4:47       ` Roman Gushchin
2021-08-14  5:25 ` [PATCH v1 04/12] mm: vmscan: rework move_pages_to_lru() Muchun Song
2021-08-14  5:25 ` [PATCH v1 05/12] mm: thp: introduce folio_split_queue_lock{_irqsave}() Muchun Song
2021-08-14  8:22   ` kernel test robot
2021-08-14 10:38   ` kernel test robot
2021-08-14  5:25 ` [PATCH v1 06/12] mm: thp: make split queue lock safe when LRU pages are reparented Muchun Song
2021-08-14  5:25 ` [PATCH v1 07/12] mm: memcontrol: make all the callers of {folio,page}_memcg() safe Muchun Song
2021-08-14  5:25 ` [PATCH v1 08/12] mm: memcontrol: introduce memcg_reparent_ops Muchun Song
2021-08-14  5:25 ` [PATCH v1 09/12] mm: memcontrol: use obj_cgroup APIs to charge the LRU pages Muchun Song
2021-08-14 14:08   ` kernel test robot [this message]
2021-08-14  5:25 ` [PATCH v1 10/12] mm: memcontrol: rename {un}lock_page_memcg() to {un}lock_page_objcg() Muchun Song
2021-08-14  5:25 ` [PATCH v1 11/12] mm: lru: add VM_BUG_ON_FOLIO to lru maintenance function Muchun Song
2021-08-14  5:25 ` [PATCH v1 12/12] mm: lru: use lruvec lock to serialize memcg changes Muchun Song

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=202108142246.xw9LO9ry-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=duanxiongchun@bytedance.com \
    --cc=fam.zheng@bytedance.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=vdavydov.dev@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).