All of lore.kernel.org
 help / color / mirror / Atom feed
From: CGEL <cgel.zte@gmail.com>
To: Michal Hocko <mhocko@suse.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	willy@infradead.org, shy828301@gmail.com,
	roman.gushchin@linux.dev, shakeelb@google.com,
	linmiaohe@huawei.com, william.kucharski@oracle.com,
	peterx@redhat.com, hughd@google.com, vbabka@suse.cz,
	songmuchun@bytedance.com, surenb@google.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	cgroups@vger.kernel.org, Yang Yang <yang.yang29@zte.com.cn>
Subject: Re: [PATCH] mm/memcg: support control THP behaviour in cgroup
Date: Tue, 10 May 2022 01:43:38 +0000	[thread overview]
Message-ID: <6279c354.1c69fb81.7f6c1.15e0@mx.google.com> (raw)
In-Reply-To: <Ynj/l+pyFJxKfcbQ@dhcp22.suse.cz>

On Mon, May 09, 2022 at 01:48:39PM +0200, Michal Hocko wrote:
> On Mon 09-05-22 11:26:43, CGEL wrote:
> > On Mon, May 09, 2022 at 12:00:28PM +0200, Michal Hocko wrote:
> > > On Sat 07-05-22 02:05:25, CGEL wrote:
> > > [...]
> > > > If there are many containers to run on one host, and some of them have high
> > > > performance requirements, administrator could turn on thp for them:
> > > > # docker run -it --thp-enabled=always
> > > > Then all the processes in those containers will always use thp.
> > > > While other containers turn off thp by:
> > > > # docker run -it --thp-enabled=never
> > > 
> > > I do not know. The THP config space is already too confusing and complex
> > > and this just adds on top. E.g. is the behavior of the knob
> > > hierarchical? What is the policy if parent memcg says madivise while
> > > child says always? How does the per-application configuration aligns
> > > with all that (e.g. memcg policy madivise but application says never via
> > > prctl while still uses some madvised - e.g. via library).
> > >
> > 
> > The cgroup THP behavior is align to host and totally independent just likes
> > /sys/fs/cgroup/memory.swappiness. That means if one cgroup config 'always'
> > for thp, it has no matter with host or other cgroup. This make it simple for
> > user to understand or control.
> 
> All controls in cgroup v2 should be hierarchical. This is really
> required for a proper delegation semantic.
>

Could we align to the semantic of /sys/fs/cgroup/memory.swappiness?
Some distributions like Ubuntu is still using cgroup v1.

> > If memcg policy madivise but application says never, just like host, the result
> > is no THP for that application.
> > 
> > > > By doing this we could promote important containers's performance with less
> > > > footprint of thp.
> > > 
> > > Do we really want to provide something like THP based QoS? To me it
> > > sounds like a bad idea and if the justification is "it might be useful"
> > > then I would say no. So you really need to come with a very good usecase
> > > to promote this further.
> > 
> > At least on some 5G(communication technology) machine, it's useful to provide
> > THP based QoS. Those 5G machine use micro-service software architecture, in
> > other words one service application runs in one container.
> 
> I am not really sure I understand. If this is one application per
> container (cgroup) then why do you really need per-group setting?
> Does the application is a set of different processes which are only very
> loosely tight?
> 
For micro-service architecture, the application in one container is not a
set of loosely tight processes, it's aim at provide one certain service,
so different containers means different service, and different service
has different QoS demand. 

The reason why we need per-group(per-container) setting is because most
container are managed by compose software, the compose software provide
UI to decide how to run a container(likes setting swappiness value). For
example the docker compose:
https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command

To make it clearer, I try to make a summary for why container needs this patch:
    1.one machine can run different containers;
    2.for some scenario, container runs only one service inside(can be only one
application);
    3.different containers provide different services, different services have
different QoS demands;
    4.THP has big influence on QoS. It's fast for memory access, but eat more
memory;
    5.containers usually managed by compose software, which treats container as
base management unit;
    6.this patch provide cgroup THP controller, which can be a method to adjust
container memory QoS.

> > Container becomes
> > the suitable management unit but not the whole host. And some performance
> > sensitive containers desiderate THP to provide low latency communication.
> > But if we use THP with 'always', it will consume more memory(on our machine
> > that is about 10% of total memory). And unnecessary huge pages will increase
> > memory pressure, add latency for minor pages faults, and add overhead when
> > splitting huge pages or coalescing normal sized pages into huge pages.
> 
> It is still not really clear to me how do you achieve that the whole
> workload in the said container has the same THP requirements.
> -- 
> Michal Hocko
> SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: CGEL <cgel.zte-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>
Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org,
	willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	shy828301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	linmiaohe-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	william.kucharski-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	peterx-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	vbabka-AlSwsSmVLrQ@public.gmane.org,
	songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org,
	surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Yang Yang <yang.yang29-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
Subject: Re: [PATCH] mm/memcg: support control THP behaviour in cgroup
Date: Tue, 10 May 2022 01:43:38 +0000	[thread overview]
Message-ID: <6279c354.1c69fb81.7f6c1.15e0@mx.google.com> (raw)
In-Reply-To: <Ynj/l+pyFJxKfcbQ-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>

On Mon, May 09, 2022 at 01:48:39PM +0200, Michal Hocko wrote:
> On Mon 09-05-22 11:26:43, CGEL wrote:
> > On Mon, May 09, 2022 at 12:00:28PM +0200, Michal Hocko wrote:
> > > On Sat 07-05-22 02:05:25, CGEL wrote:
> > > [...]
> > > > If there are many containers to run on one host, and some of them have high
> > > > performance requirements, administrator could turn on thp for them:
> > > > # docker run -it --thp-enabled=always
> > > > Then all the processes in those containers will always use thp.
> > > > While other containers turn off thp by:
> > > > # docker run -it --thp-enabled=never
> > > 
> > > I do not know. The THP config space is already too confusing and complex
> > > and this just adds on top. E.g. is the behavior of the knob
> > > hierarchical? What is the policy if parent memcg says madivise while
> > > child says always? How does the per-application configuration aligns
> > > with all that (e.g. memcg policy madivise but application says never via
> > > prctl while still uses some madvised - e.g. via library).
> > >
> > 
> > The cgroup THP behavior is align to host and totally independent just likes
> > /sys/fs/cgroup/memory.swappiness. That means if one cgroup config 'always'
> > for thp, it has no matter with host or other cgroup. This make it simple for
> > user to understand or control.
> 
> All controls in cgroup v2 should be hierarchical. This is really
> required for a proper delegation semantic.
>

Could we align to the semantic of /sys/fs/cgroup/memory.swappiness?
Some distributions like Ubuntu is still using cgroup v1.

> > If memcg policy madivise but application says never, just like host, the result
> > is no THP for that application.
> > 
> > > > By doing this we could promote important containers's performance with less
> > > > footprint of thp.
> > > 
> > > Do we really want to provide something like THP based QoS? To me it
> > > sounds like a bad idea and if the justification is "it might be useful"
> > > then I would say no. So you really need to come with a very good usecase
> > > to promote this further.
> > 
> > At least on some 5G(communication technology) machine, it's useful to provide
> > THP based QoS. Those 5G machine use micro-service software architecture, in
> > other words one service application runs in one container.
> 
> I am not really sure I understand. If this is one application per
> container (cgroup) then why do you really need per-group setting?
> Does the application is a set of different processes which are only very
> loosely tight?
> 
For micro-service architecture, the application in one container is not a
set of loosely tight processes, it's aim at provide one certain service,
so different containers means different service, and different service
has different QoS demand. 

The reason why we need per-group(per-container) setting is because most
container are managed by compose software, the compose software provide
UI to decide how to run a container(likes setting swappiness value). For
example the docker compose:
https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command

To make it clearer, I try to make a summary for why container needs this patch:
    1.one machine can run different containers;
    2.for some scenario, container runs only one service inside(can be only one
application);
    3.different containers provide different services, different services have
different QoS demands;
    4.THP has big influence on QoS. It's fast for memory access, but eat more
memory;
    5.containers usually managed by compose software, which treats container as
base management unit;
    6.this patch provide cgroup THP controller, which can be a method to adjust
container memory QoS.

> > Container becomes
> > the suitable management unit but not the whole host. And some performance
> > sensitive containers desiderate THP to provide low latency communication.
> > But if we use THP with 'always', it will consume more memory(on our machine
> > that is about 10% of total memory). And unnecessary huge pages will increase
> > memory pressure, add latency for minor pages faults, and add overhead when
> > splitting huge pages or coalescing normal sized pages into huge pages.
> 
> It is still not really clear to me how do you achieve that the whole
> workload in the said container has the same THP requirements.
> -- 
> Michal Hocko
> SUSE Labs

  reply	other threads:[~2022-05-10  1:43 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  3:38 [PATCH] mm/memcg: support control THP behaviour in cgroup cgel.zte
2022-05-05  3:38 ` cgel.zte-Re5JQEeQqe8AvxtiuMwx3w
2022-05-05 12:49 ` kernel test robot
2022-05-05 12:49   ` kernel test robot
2022-05-05 13:31 ` kernel test robot
2022-05-05 13:31   ` kernel test robot
2022-05-05 16:09 ` kernel test robot
2022-05-05 16:09   ` kernel test robot
2022-05-06 13:41 ` Michal Hocko
2022-05-06 13:41   ` Michal Hocko
2022-05-07  2:05   ` CGEL
2022-05-07  2:05     ` CGEL
2022-05-09 10:00     ` Michal Hocko
2022-05-09 10:00       ` Michal Hocko
2022-05-09 11:26       ` CGEL
2022-05-09 11:26         ` CGEL
2022-05-09 11:48         ` Michal Hocko
2022-05-09 11:48           ` Michal Hocko
2022-05-10  1:43           ` CGEL [this message]
2022-05-10  1:43             ` CGEL
2022-05-10 10:00             ` Michal Hocko
2022-05-10 10:00               ` Michal Hocko
2022-05-10 11:52               ` CGEL
2022-05-10 11:52                 ` CGEL
2022-05-10 13:36                 ` Michal Hocko
2022-05-10 13:36                   ` Michal Hocko
2022-05-11  1:59                   ` CGEL
2022-05-11  1:59                     ` CGEL
2022-05-11  7:21                     ` Michal Hocko
2022-05-11  7:21                       ` Michal Hocko
2022-05-11  9:47                       ` CGEL
2022-05-18  5:58                   ` CGEL
2022-05-18  5:58                     ` CGEL
2022-05-10 19:34             ` Yang Shi
2022-05-10 19:34               ` Yang Shi
2022-05-11  2:19               ` CGEL
2022-05-11  2:19                 ` CGEL
2022-05-11  2:47                 ` Shakeel Butt
2022-05-11  2:47                   ` Shakeel Butt
2022-05-11  3:11                   ` Roman Gushchin
2022-05-11  3:11                     ` Roman Gushchin
2022-05-11  3:31                     ` CGEL
2022-05-11  3:31                       ` CGEL
2022-05-18  8:14                       ` Balbir Singh
2022-05-18  8:14                         ` Balbir Singh
2022-05-11  3:17                   ` CGEL
2022-05-11  3:17                     ` CGEL

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=6279c354.1c69fb81.7f6c1.15e0@mx.google.com \
    --to=cgel.zte@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=peterx@redhat.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    --cc=yang.yang29@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.