linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Zhaoyang Huang <huangzhaoyang@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>, Tejun Heo <tj@kernel.org>,
	Shakeel Butt <shakeelb@google.com>,
	"zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Linux MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>, Ke Wang <ke.wang@unisoc.com>,
	Zefan Li <lizefan.x@bytedance.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <songmuchun@bytedance.com>
Subject: Re: [RFC PATCH] memcg: use root_mem_cgroup when css is inherited
Date: Wed, 24 Aug 2022 12:27:00 +0200	[thread overview]
Message-ID: <YwX89JCQCKMMYdG9@dhcp22.suse.cz> (raw)
In-Reply-To: <CAGWkznEqX3DwHW_owiK+HuuQ-HsUYK4vKmLhSxgzGn20Vzid2A@mail.gmail.com>

On Wed 24-08-22 17:34:42, Zhaoyang Huang wrote:
> On Wed, Aug 24, 2022 at 3:50 PM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Wed 24-08-22 10:23:14, Zhaoyang Huang wrote:
> > > On Tue, Aug 23, 2022 at 7:51 PM Michal Hocko <mhocko@suse.com> 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.

I really fail to understand your requirements.

> IMHO, charging the pages which out of explicitly memory
> enabled group to root could solve all of the above constraints with no
> harm.

This would break the hierarchical property of the controller. So a
strong no no. Consider the following example

       root
	|
	A
controllers="memory"
memory.max = 1G
subtree_control=""
|      |      |
A1     A2     A3

althought A1,2,3 do not have their memory controller enabled explicitly
they are still constrained by the A memcg limit. If you just charge to
the root because it doesn't have memory controller enabled explicitly
then you just evade that constrain. I hope you understand why that is a
problem.
-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2022-08-24 10:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 11:29 [RFC PATCH] memcg: use root_mem_cgroup when css is inherited zhaoyang.huang
2022-08-19 16:29 ` Tejun Heo
2022-08-19 17:08   ` Shakeel Butt
2022-08-19 17:10     ` Tejun Heo
     [not found]       ` <YwNpI1ydy0yDnBH0@dhcp22.suse.cz>
2022-08-23  2:31         ` Zhaoyang Huang
     [not found]           ` <YwRjyx6wFLk8WTDe@dhcp22.suse.cz>
2022-08-23  6:03             ` Zhaoyang Huang
2022-08-23  8:33               ` Michal Hocko
2022-08-23  9:20                 ` Zhaoyang Huang
2022-08-23 11:51                   ` Michal Hocko
2022-08-23 16:21                     ` Suren Baghdasaryan
2022-08-24  7:59                       ` Michal Hocko
2022-08-24 17:13                         ` Suren Baghdasaryan
2022-08-24  2:23                     ` Zhaoyang Huang
2022-08-24  7:50                       ` Michal Hocko
2022-08-24  9:34                         ` Zhaoyang Huang
2022-08-24 10:27                           ` Michal Hocko [this message]
2022-08-25  0:43                             ` Zhaoyang Huang
2022-08-25  6:40                               ` Michal Hocko
2022-08-25  8:34                                 ` Zhaoyang Huang
2022-08-25  8:50                                   ` Michal Hocko
2022-08-25 10:11                                     ` Zhaoyang Huang
2022-08-25 13:35                                       ` Johannes Weiner

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=YwX89JCQCKMMYdG9@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=huangzhaoyang@gmail.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan.x@bytedance.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=zhaoyang.huang@unisoc.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;
as well as URLs for NNTP newsgroup(s).