From: Yafang Shao <laoar.shao@gmail.com>
To: mhocko@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com,
akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH] mm, memcg: don't protect pages if memcg is not populated
Date: Sat, 23 Nov 2019 00:56:42 -0500 [thread overview]
Message-ID: <1574488602-11773-1-git-send-email-laoar.shao@gmail.com> (raw)
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
next reply other threads:[~2019-11-23 5:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 5:56 Yafang Shao [this message]
2019-11-25 8:14 ` Michal Hocko
2019-11-25 9:11 ` Yafang Shao
2019-11-25 9:38 ` Michal Hocko
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=1574488602-11773-1-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--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