On Sat 23-11-19 00:56:42, Yafang Shao wrote: > 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. Well, the min resp. low limits protect charges rather than tasks. And thre are cases when there is no direct relation between the charged memory and a specific task - e.g. long living kernel objects or page cache. So there is nothing really unusual to have charges in an absence of any tasks. I do not really see any reason why the protection shouldn't apply to them. Such a be behavior would be quite inconsistent btw. Just imagine a case when there is _a_ task but that one doesn't really have any charges in the memcg. Why should we respect reclaim protection in that case? Btw. offlined memcgs already have no min/low watermarks protect. Do you have any specific usecase that suffers from this behavior? > 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 -- Michal Hocko SUSE Labs