All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm, memcg: don't protect pages if memcg is not populated
@ 2019-11-23  5:56 Yafang Shao
  2019-11-25  8:14 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Yafang Shao @ 2019-11-23  5:56 UTC (permalink / raw)
  To: mhocko, hannes, vdavydov.dev, akpm; +Cc: linux-mm, Yafang Shao

memory.{min, low} keeps protecting pages in a memcg even if there're no
process running in this memcg. That makes nonsense, because if there're
no processes running in this memcg there may be something wrong happens
and these protected pages are not useful now.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1c4c08b..c96c282 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6376,6 +6376,9 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root,
 	if (memcg == root)
 		return MEMCG_PROT_NONE;
 
+	if (!cgroup_is_populated(memcg->css.cgroup))
+		return MEMCG_PROT_NONE;
+
 	usage = page_counter_read(&memcg->memory);
 	if (!usage)
 		return MEMCG_PROT_NONE;
-- 
1.8.3.1



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

end of thread, other threads:[~2019-11-25  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23  5:56 [PATCH] mm, memcg: don't protect pages if memcg is not populated Yafang Shao
2019-11-25  8:14 ` Michal Hocko
2019-11-25  9:11   ` Yafang Shao
2019-11-25  9:38     ` Michal Hocko

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.