Re: [RFC PATCH] memcg: use root_mem_cgroup when css is inherited

From: Michal Hocko
Date: Wed Aug 24 2022 - 03:50:52 EST


On Wed 24-08-22 10:23:14, Zhaoyang Huang wrote:
> On Tue, Aug 23, 2022 at 7:51 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
[...]
> > One way to achieve that would be shaping the hierarchy the following way
> > root
> > / \
> > no_memcg[1] memcg[2]
> > |||||||| |||||
> > app_cgroups app_cgroups
> >
> > with
> > no_memcg.subtree_control = ""
> > memcg.subtree_control = memory
> >
> > no?
> According to my understanding, No as there will be no no_memcg. All
> children groups under root would have its cgroup.controllers = memory
> as long as root has memory enabled.

Correct

> Under this circumstance, all
> descendants group under 'no_memcg' will charge memory to its parent
> group.

Correct. And why is that a problem? I thought you main concern was a per
application LRUs. With the above configuration all app_cgroups which do
not require an explicit memory control will share the same (no_memcg)
LRU and they will be aged together.
--
Michal Hocko
SUSE Labs