linux-kernel.vger.kernel.org archive mirror
 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
  0 siblings, 1 reply; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

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

Thread overview: 2+ 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

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).