[PATCH] mm, memcg: don't protect pages if memcg is not populated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux