From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030387AbdLSMtn (ORCPT ); Tue, 19 Dec 2017 07:49:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:36349 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762797AbdLSMtN (ORCPT ); Tue, 19 Dec 2017 07:49:13 -0500 Date: Tue, 19 Dec 2017 13:49:08 +0100 From: Michal Hocko To: Shakeel Butt Cc: Tejun Heo , Li Zefan , Roman Gushchin , Vladimir Davydov , Greg Thelen , Johannes Weiner , Hugh Dickins , Andrew Morton , 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 Message-ID: <20171219124908.GS2787@dhcp22.suse.cz> References: <20171219000131.149170-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171219000131.149170-1-shakeelb@google.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Michal Hocko SUSE Labs