All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec
@ 2020-11-20  9:30 Alex Shi
  2020-11-20 10:31 ` Alex Shi
  2020-11-20 13:40 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Shi @ 2020-11-20  9:30 UTC (permalink / raw)
  Cc: Andrew Morton, Johannes Weiner, Shakeel Butt, Roman Gushchin,
	Michal Hocko, Yafang Shao, Alexander Duyck, Hui Su, Wei Yang,
	linux-kernel

commit "(mm/memcontrol:rewrite mem_cgroup_page_lruvec())" on mm tree use
mem_cgroup_lruvec to rewrite mem_cgroup_page_lruvec, but it missed a
DEBUG_VM warning as following, since we always charge a page before
return from allocation. Add back this warning is helpful:

	VM_WARN_ON_ONCE_PAGE(!memcg, page);

Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org> 
Cc: Johannes Weiner <hannes@cmpxchg.org> 
Cc: Shakeel Butt <shakeelb@google.com> 
Cc: Roman Gushchin <guro@fb.com> 
Cc: Michal Hocko <mhocko@suse.com> 
Cc: Yafang Shao <laoar.shao@gmail.com> 
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com> 
Cc: Hui Su <sh_def@163.com>
Cc: Wei Yang <richard.weiyang@gmail.com> 
Cc: linux-kernel@vger.kernel.org 
---
 include/linux/memcontrol.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 925b09ace986..7809020ef7bd 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -618,6 +618,7 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
 		goto out;
 	}
 
+	VM_WARN_ON_ONCE_PAGE(!memcg, page);
 	if (!memcg)
 		memcg = root_mem_cgroup;
 
-- 
2.29.GIT


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec
  2020-11-20  9:30 [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec Alex Shi
@ 2020-11-20 10:31 ` Alex Shi
  2020-11-20 13:40 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Shi @ 2020-11-20 10:31 UTC (permalink / raw)
  Cc: Andrew Morton, Johannes Weiner, Shakeel Butt, Roman Gushchin,
	Michal Hocko, Yafang Shao, Alexander Duyck, Hui Su, Wei Yang,
	linux-kernel



在 2020/11/20 下午5:30, Alex Shi 写道:
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 925b09ace986..7809020ef7bd 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -618,6 +618,7 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
>  		goto out;
>  	}
>  
> +	VM_WARN_ON_ONCE_PAGE(!memcg, page);

Very sorry for typo above! please use the updated patch.


From 68d69172f21f39928cf8ff204f5ff5cd62ac7776 Mon Sep 17 00:00:00 2001
From: Alex Shi <alex.shi@linux.alibaba.com>
Date: Fri, 20 Nov 2020 17:02:41 +0800
Subject: [PATCH] mm/memcg: add missed warning in mem_cgroup_lruvec

commit "(mm/memcontrol:rewrite mem_cgroup_page_lruvec())" on mm tree use
mem_cgroup_lruvec to rewrite mem_cgroup_page_lruvec, but it missed a
DEBUG_VM warning as following, since we always charge a page before
return from allocation. Add back this warning is helpful:

	VM_WARN_ON_ONCE(!memcg);

Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org> 
Cc: Johannes Weiner <hannes@cmpxchg.org> 
Cc: Shakeel Butt <shakeelb@google.com> 
Cc: Roman Gushchin <guro@fb.com> 
Cc: Michal Hocko <mhocko@suse.com> 
Cc: Yafang Shao <laoar.shao@gmail.com> 
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com> 
Cc: Hui Su <sh_def@163.com>
Cc: Wei Yang <richard.weiyang@gmail.com> 
Cc: linux-kernel@vger.kernel.org 
---
 include/linux/memcontrol.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 925b09ace986..303438822818 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -618,6 +618,7 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
 		goto out;
 	}
 
+	VM_WARN_ON_ONCE(!memcg);
 	if (!memcg)
 		memcg = root_mem_cgroup;
 
-- 
2.29.GIT


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec
  2020-11-20  9:30 [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec Alex Shi
  2020-11-20 10:31 ` Alex Shi
@ 2020-11-20 13:40 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-20 13:40 UTC (permalink / raw)
  To: kbuild-all

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

Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master hnaz-linux-mm/master v5.10-rc4 next-20201120]
[cannot apply to mmotm/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/Alex-Shi/mm-memcg-add-missed-warning-in-mem_cgroup_lruvec/20201120-173445
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
config: arm64-randconfig-r024-20201120 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 3ded927cf80ac519f9f9c4664fef08787f7c537d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/f580d4709882cff6450e1b1cab47ea1c7d7c1e79
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alex-Shi/mm-memcg-add-missed-warning-in-mem_cgroup_lruvec/20201120-173445
        git checkout f580d4709882cff6450e1b1cab47ea1c7d7c1e79
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/arm64/kernel/asm-offsets.c:16:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   include/linux/memcontrol.h:476:2: error: implicit declaration of function 'VM_WARN_ON_ONCE_PAGE' [-Werror,-Wimplicit-function-declaration]
           VM_WARN_ON_ONCE_PAGE(!memcg, page);
           ^
>> include/linux/memcontrol.h:476:31: error: use of undeclared identifier 'page'
           VM_WARN_ON_ONCE_PAGE(!memcg, page);
                                        ^
   2 errors generated.
   make[2]: *** [scripts/Makefile.build:117: arch/arm64/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1200: prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:185: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.

vim +/page +476 include/linux/memcontrol.h

   456	
   457	/**
   458	 * mem_cgroup_lruvec - get the lru list vector for a memcg & node
   459	 * @memcg: memcg of the wanted lruvec
   460	 *
   461	 * Returns the lru list vector holding pages for a given @memcg &
   462	 * @node combination. This can be the node lruvec, if the memory
   463	 * controller is disabled.
   464	 */
   465	static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
   466						       struct pglist_data *pgdat)
   467	{
   468		struct mem_cgroup_per_node *mz;
   469		struct lruvec *lruvec;
   470	
   471		if (mem_cgroup_disabled()) {
   472			lruvec = &pgdat->__lruvec;
   473			goto out;
   474		}
   475	
 > 476		VM_WARN_ON_ONCE_PAGE(!memcg, page);
   477		if (!memcg)
   478			memcg = root_mem_cgroup;
   479	
   480		mz = mem_cgroup_nodeinfo(memcg, pgdat->node_id);
   481		lruvec = &mz->lruvec;
   482	out:
   483		/*
   484		 * Since a node can be onlined after the mem_cgroup was created,
   485		 * we have to be prepared to initialize lruvec->pgdat here;
   486		 * and if offlined then reonlined, we need to reinitialize it.
   487		 */
   488		if (unlikely(lruvec->pgdat != pgdat))
   489			lruvec->pgdat = pgdat;
   490		return lruvec;
   491	}
   492	

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-20 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20  9:30 [PATCH next-akpm] mm/memcg: add missed warning in mem_cgroup_lruvec Alex Shi
2020-11-20 10:31 ` Alex Shi
2020-11-20 13:40 ` kernel test robot

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.