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

From: Zhaoyang Huang
Date: Wed Aug 24 2022 - 05:35:18 EST


On Wed, Aug 24, 2022 at 3:50 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
>
> 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.
I can't agree since this indicates the processes want memory free
depending on a specific hierarchy which could have been determined by
other subsys. IMHO, charging the pages which out of explicitly memory
enabled group to root could solve all of the above constraints with no
harm.
> --
> Michal Hocko
> SUSE Labs