linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Michal Hocko <mhocko@suse.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: Thu, 25 Aug 2022 18:11:09 +0800	[thread overview]
Message-ID: <CAGWkznHL_G3OoAc5gJ+iwxqxonr21-fU+F4T2gkpXH68keLpuQ@mail.gmail.com> (raw)
In-Reply-To: <Ywc34ci5XUMXOSYA@dhcp22.suse.cz>

On Thu, Aug 25, 2022 at 4:50 PM Michal Hocko <mhocko@suse.com> wrote:
>
> On Thu 25-08-22 16:34:04, Zhaoyang Huang wrote:
> > On Thu, Aug 25, 2022 at 2:40 PM Michal Hocko <mhocko@suse.com> wrote:
> > >
> > > On Thu 25-08-22 08:43:52, Zhaoyang Huang wrote:
> > > > On Wed, Aug 24, 2022 at 6:27 PM Michal Hocko <mhocko@suse.com> wrote:
> > > > >
> > > > > On Wed 24-08-22 17:34:42, Zhaoyang Huang wrote:
> > > [...]
> > > > > > 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.
> > > > IMO, A1-A3 should be explicitly enabled via echo "+memory" >
> > > > A/subtree_control since memory.max has been set.
> > >
> > > You seem to be missing the point I've triedy to make here. It is not
> > > about how the respective subtree should or shouldn't be configured. It
> > > is about the hierarchical behavior. Configuration at a higher level should be
> > > enforced under subtree no matter how that subtree decides to
> > > enabled/disable controllers. Such subtree might have beeb delegated
> > > and configured differently yet the constrain should be still applied.
> > > See the point?
> > >
> > > What you seem to be proposing is similar to cgroup v1 use_hierarchy
> > > configuration. It has been decided that this is undesirable very early
> > > in the cgroup v2 development because it make delegation impossible
> > > (among other reasons).
> > Ok, I would like to know how AA3 achieve the goal of competing with A1
> > and A2 for cpu but keep memory out of control under current policy?
> >         root
> >          |
> >          A
> >  controllers="memory,cpu"
> >  memory.max = 1G
> >  subtree_control="memory,cpu"
> >  |      |            |
> >  A1     A2     A3 subtree_control="cpu"
> >                       |      |
> >                     AA3   AA4 controllers="cpu"
>
> I cannot really give you configuration you want without understanding
> what you are trying to achieve and why do you need it that way. Really,
> you can construct arbitrary hierarchies and only a very small subset of
> them actually makes sense. So far you have been very terse at your goals
> and intentions but rather demanding on the underlying mechanisms. This
> doesn't really makes the discussion productive.
>
> I hope you have at least understood that hierarchical property of the
> cgroup v2 is a must and it won't change. If you need a help to construct
> hierarchy for your specific workload I would recommend to clearly state
> your final goal and reasoning behind. Maybe you will get a more specific
> help that way. Good luck!
Sorry for any misunderstanding among the discussion. My purpose is
real and simple as I have stated from the very beginning that I would
like to have per-app cgroup hierarchy to charge memory to root if it
is not enabled explicitly for memory. The reason has also been stated
like reclaim and workingset regression in suren's report. I don't
think my proposal will do any harm to current v2's mechanism besides
asking for the admin echo "+memory" to their desire group.
> --
> Michal Hocko
> SUSE Labs


  reply	other threads:[~2022-08-25 10:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 11:29 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
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 [this message]
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=CAGWkznHL_G3OoAc5gJ+iwxqxonr21-fU+F4T2gkpXH68keLpuQ@mail.gmail.com \
    --to=huangzhaoyang@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mhocko@suse.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