On Tue 05-04-22 02:22:18, Wei Yang wrote: > On Mon, Apr 04, 2022 at 11:27:53AM +0200, Michal Hocko wrote: > >On Sun 03-04-22 02:08:33, Wei Yang wrote: > >> After commit bef8620cd8e0 ("mm: memcg: deprecate the non-hierarchical > >> mode"), we won't have a NULL parent except root_mem_cgroup. And this > >> case is handled when (memcg == root). > >> > >> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> > >> CC: Roman Gushchin <roman.gushchin@xxxxxxxxx> > >> CC: Johannes Weiner <hannes@xxxxxxxxxxx> > > > >Acked-by: Michal Hocko <mhocko@xxxxxxxx> > >Thanks! > > > > Thanks for the ack. When reading the code, I found one redundant check in > shrink_node_memcgs(). > > shrink_node_memcgs > mem_cgroup_below_min > mem_cgroup_supports_protection > mem_cgroup_below_low > mem_cgroup_supports_protection > > I am not sure it worthwhile to take it out. > > shrink_node_memcgs > mem_cgroup_supports_protection > mem_cgroup_below_min > mem_cgroup_below_low > > Look forward your opinion. I guess you refer to mem_cgroup_is_root check in mem_cgroup_supports_protection, right? You are right that the check is not really required because e{min,low} should always stay at 0 for the root memcg AFAICS. On the other hand the check is not in any hot path and it really adds clarity here because protection is not really supported on the root memcg. So I am not this is an overall win. -- Michal Hocko SUSE Labs