All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
	Roman Gushchin <guro@fb.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Greg Thelen <gthelen@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH] mm: memcontrol: memory+swap accounting for cgroup-v2
Date: Tue, 19 Dec 2017 13:49:08 +0100	[thread overview]
Message-ID: <20171219124908.GS2787@dhcp22.suse.cz> (raw)
In-Reply-To: <20171219000131.149170-1-shakeelb@google.com>

On Mon 18-12-17 16:01:31, Shakeel Butt wrote:
> The memory controller in cgroup v1 provides the memory+swap (memsw)
> interface to account to the combined usage of memory and swap of the
> jobs. The memsw interface allows the users to limit or view the
> consistent memory usage of their jobs irrespectibe of the presense of
> swap on the system (consistent OOM and memory reclaim behavior). The
> memory+swap accounting makes the job easier for centralized systems
> doing resource usage monitoring, prediction or anomaly detection.
> 
> In cgroup v2, the 'memsw' interface was dropped and a new 'swap'
> interface has been introduced which allows to limit the actual usage of
> swap by the job. For the systems where swap is a limited resource,
> 'swap' interface can be used to fairly distribute the swap resource
> between different jobs. There is no easy way to limit the swap usage
> using the 'memsw' interface.
> 
> However for the systems where the swap is cheap and can be increased
> dynamically (like remote swap and swap on zram), the 'memsw' interface
> is much more appropriate as it makes swap transparent to the jobs and
> gives consistent memory usage history to centralized monitoring systems.
> 
> This patch adds memsw interface to cgroup v2 memory controller behind a
> mount option 'memsw'. The memsw interface is mutually exclusive with
> the existing swap interface. When 'memsw' is enabled, reading or writing
> to 'swap' interface files will return -ENOTSUPP and vice versa. Enabling
> or disabling memsw through remounting cgroup v2, will only be effective
> if there are no decendants of the root cgroup.
> 
> When memsw accounting is enabled then "memory.high" is comapred with
> memory+swap usage. So, when the allocating job's memsw usage hits its
> high mark, the job will be throttled by triggering memory reclaim.

From a quick look, this looks like a mess. We have agreed to go with
the current scheme for some good reasons. There are cons/pros for both
approaches but I am not convinced we should convolute the user API for
the usecase you describe.

> Signed-off-by: Shakeel Butt <shakeelb@google.com>
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
	Roman Gushchin <guro@fb.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Greg Thelen <gthelen@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH] mm: memcontrol: memory+swap accounting for cgroup-v2
Date: Tue, 19 Dec 2017 13:49:08 +0100	[thread overview]
Message-ID: <20171219124908.GS2787@dhcp22.suse.cz> (raw)
In-Reply-To: <20171219000131.149170-1-shakeelb@google.com>

On Mon 18-12-17 16:01:31, Shakeel Butt wrote:
> The memory controller in cgroup v1 provides the memory+swap (memsw)
> interface to account to the combined usage of memory and swap of the
> jobs. The memsw interface allows the users to limit or view the
> consistent memory usage of their jobs irrespectibe of the presense of
> swap on the system (consistent OOM and memory reclaim behavior). The
> memory+swap accounting makes the job easier for centralized systems
> doing resource usage monitoring, prediction or anomaly detection.
> 
> In cgroup v2, the 'memsw' interface was dropped and a new 'swap'
> interface has been introduced which allows to limit the actual usage of
> swap by the job. For the systems where swap is a limited resource,
> 'swap' interface can be used to fairly distribute the swap resource
> between different jobs. There is no easy way to limit the swap usage
> using the 'memsw' interface.
> 
> However for the systems where the swap is cheap and can be increased
> dynamically (like remote swap and swap on zram), the 'memsw' interface
> is much more appropriate as it makes swap transparent to the jobs and
> gives consistent memory usage history to centralized monitoring systems.
> 
> This patch adds memsw interface to cgroup v2 memory controller behind a
> mount option 'memsw'. The memsw interface is mutually exclusive with
> the existing swap interface. When 'memsw' is enabled, reading or writing
> to 'swap' interface files will return -ENOTSUPP and vice versa. Enabling
> or disabling memsw through remounting cgroup v2, will only be effective
> if there are no decendants of the root cgroup.
> 
> When memsw accounting is enabled then "memory.high" is comapred with
> memory+swap usage. So, when the allocating job's memsw usage hits its
> high mark, the job will be throttled by triggering memory reclaim.

>From a quick look, this looks like a mess. We have agreed to go with
the current scheme for some good reasons. There are cons/pros for both
approaches but I am not convinced we should convolute the user API for
the usecase you describe.

> Signed-off-by: Shakeel Butt <shakeelb@google.com>
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
	Roman Gushchin <guro@fb.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Greg Thelen <gthelen@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH] mm: memcontrol: memory+swap accounting for cgroup-v2
Date: Tue, 19 Dec 2017 13:49:08 +0100	[thread overview]
Message-ID: <20171219124908.GS2787@dhcp22.suse.cz> (raw)
In-Reply-To: <20171219000131.149170-1-shakeelb@google.com>

On Mon 18-12-17 16:01:31, Shakeel Butt wrote:
> The memory controller in cgroup v1 provides the memory+swap (memsw)
> interface to account to the combined usage of memory and swap of the
> jobs. The memsw interface allows the users to limit or view the
> consistent memory usage of their jobs irrespectibe of the presense of
> swap on the system (consistent OOM and memory reclaim behavior). The
> memory+swap accounting makes the job easier for centralized systems
> doing resource usage monitoring, prediction or anomaly detection.
> 
> In cgroup v2, the 'memsw' interface was dropped and a new 'swap'
> interface has been introduced which allows to limit the actual usage of
> swap by the job. For the systems where swap is a limited resource,
> 'swap' interface can be used to fairly distribute the swap resource
> between different jobs. There is no easy way to limit the swap usage
> using the 'memsw' interface.
> 
> However for the systems where the swap is cheap and can be increased
> dynamically (like remote swap and swap on zram), the 'memsw' interface
> is much more appropriate as it makes swap transparent to the jobs and
> gives consistent memory usage history to centralized monitoring systems.
> 
> This patch adds memsw interface to cgroup v2 memory controller behind a
> mount option 'memsw'. The memsw interface is mutually exclusive with
> the existing swap interface. When 'memsw' is enabled, reading or writing
> to 'swap' interface files will return -ENOTSUPP and vice versa. Enabling
> or disabling memsw through remounting cgroup v2, will only be effective
> if there are no decendants of the root cgroup.
> 
> When memsw accounting is enabled then "memory.high" is comapred with
> memory+swap usage. So, when the allocating job's memsw usage hits its
> high mark, the job will be throttled by triggering memory reclaim.

>From a quick look, this looks like a mess. We have agreed to go with
the current scheme for some good reasons. There are cons/pros for both
approaches but I am not convinced we should convolute the user API for
the usecase you describe.

> Signed-off-by: Shakeel Butt <shakeelb@google.com>
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2017-12-19 12:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19  0:01 [RFC PATCH] mm: memcontrol: memory+swap accounting for cgroup-v2 Shakeel Butt
2017-12-19  0:01 ` Shakeel Butt
2017-12-19 12:49 ` Michal Hocko [this message]
2017-12-19 12:49   ` Michal Hocko
2017-12-19 12:49   ` Michal Hocko
2017-12-19 15:12   ` Shakeel Butt
2017-12-19 15:12     ` Shakeel Butt
2017-12-19 15:24     ` Tejun Heo
2017-12-19 15:24       ` Tejun Heo
2017-12-19 17:23       ` Shakeel Butt
2017-12-19 17:23         ` Shakeel Butt
2017-12-19 17:33         ` Tejun Heo
2017-12-19 17:33           ` Tejun Heo
     [not found]           ` <20171219173354.GQ3919388-4dN5La/x3IkLX0oZNxdnEQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2017-12-19 18:25             ` Shakeel Butt
2017-12-19 18:25               ` Shakeel Butt
2017-12-19 18:25               ` Shakeel Butt
2017-12-19 21:41               ` Tejun Heo
2017-12-19 21:41                 ` Tejun Heo
2017-12-19 22:39                 ` Shakeel Butt
2017-12-19 22:39                   ` Shakeel Butt
     [not found]                   ` <CALvZod5XRhXc3XrQw50Jw_OpRQB2iCCbgG-NMDCa8xRmGNdLrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-20 19:37                     ` Tejun Heo
2017-12-20 19:37                       ` Tejun Heo
2017-12-20 19:37                       ` Tejun Heo
2017-12-20 20:15                       ` Shakeel Butt
2017-12-20 20:15                         ` Shakeel Butt
2017-12-20 20:27                         ` Shakeel Butt
2017-12-20 20:27                           ` Shakeel Butt
2017-12-20 23:36                         ` Tejun Heo
2017-12-20 23:36                           ` Tejun Heo
2017-12-21  1:15                           ` Shakeel Butt
2017-12-21  1:15                             ` Shakeel Butt
2017-12-21 13:37                             ` Tejun Heo
2017-12-21 13:37                               ` Tejun Heo
2017-12-21 15:22                               ` Shakeel Butt
2017-12-21 15:22                                 ` Shakeel Butt
2017-12-21 15:33                                 ` Shakeel Butt
2017-12-21 15:33                                   ` Shakeel Butt
     [not found]                                 ` <CALvZod432hzxPZgAypjPsZ33Z==0MxmMdPM3bEBZMea-7GFAVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-12-21 17:29                                   ` Tejun Heo
2017-12-21 17:29                                     ` Tejun Heo
2017-12-21 17:29                                     ` Tejun Heo
2017-12-27 19:49                                     ` Shakeel Butt
2017-12-27 19:49                                       ` Shakeel Butt

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=20171219124908.GS2787@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=gthelen@google.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=shakeelb@google.com \
    --cc=tj@kernel.org \
    --cc=vdavydov.dev@gmail.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 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.