Received: by 10.192.165.148 with SMTP id m20csp522080imm; Fri, 20 Apr 2018 10:30:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/WxDkuKPGYEIKd2MYBg6I4TEBNodGpj+hMCZbIvG5dGmJ1Z3hkegigBWS4BJsqfNtb/bS5 X-Received: by 10.101.80.131 with SMTP id r3mr9172820pgp.284.1524245447035; Fri, 20 Apr 2018 10:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524245446; cv=none; d=google.com; s=arc-20160816; b=HS0ewZg2UJydzWEaNXIPSQx2HIOW4MuRbn6jfq+Fvp6+TwAygkxQWDsoOUiRWHn2EI +8A3JVqdQILTXhsjT57i1/AqHfSy0P79y04Pe7Hl+CXZ/XY3PEaGoF6QnwSJayUQp3QQ 1qJfgAA5J/V/VhrePgJKhuXSY1lWYSW9/qI/fCb83VDCSQpsV3S8zI77I/kqQjlifJ7s hNm660MvXepwluV5/kL4Jg7pWOCqUK4V87Mw0sdvJe2VyNx4W9yGcyBb18iRxfVTXCWi 8Dm+gi/5iuNxe+jgCo0Ffc7+OEdtu9j/E28AFXuyjtAKJRUG2JxGPa5WI55TbF476xfO KVTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=oShycAtc7FeLgNixkM4wOWJ3Bqf05q4zgJqCxU3dUu8=; b=y2D5Kle8GY9EdaYCO8UrHsp1MlKPw6o90pnT45U/X/4nrQFkUJN25uCf3lNc4ec3/X 267TjwwMKMRFjyGvhXzGK2/ZL3x5a3ftapi4musTRXecGsUdQcZ5/kyIvJsNJMlKomSS QmthaP7KU5bxyXfFisPvPglsaP4oulRkfIxHq9KeK3oGvfQVThUhMaIEZyrFrBtfRJXA CICp2in5MiNh8x43zxpEgEt5WpCMrDk0MtXh+ttHqkVSvLf6AgirMjGF0vgA+SLrHGMG 3fOwfObZBxvNkAaKNrZZ/8Uzt6ulS7KFJ7rvfApwEyiLBEp+MdKtws0Bhb28G6lwz4Gn 0S1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=CTX3YQPR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k66si425557pga.118.2018.04.20.10.30.32; Fri, 20 Apr 2018 10:30:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=CTX3YQPR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599AbeDTR3Y (ORCPT + 99 others); Fri, 20 Apr 2018 13:29:24 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55064 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbeDTR3X (ORCPT ); Fri, 20 Apr 2018 13:29:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oShycAtc7FeLgNixkM4wOWJ3Bqf05q4zgJqCxU3dUu8=; b=CTX3YQPRJPcc2ioD1VWT1ot7KF JpJneFna5Felot6EBhtsrM0qy2VF9OhAE9TzOCreyDk0DYovwhg5Hyu4oYvqPAEdQXB8l1PcsMdIB JQO6ivu+LUFBFt71ZMvhrMkpHJyLijT1ke/PThNhnw15invkKNAybyAkvr3Uz8yM94KiH5WhZxaQG U9Qp5dv+bz0gP/29v3/t65TNN0koOx4f7cMZM3jXZWB+m5QPci0GfYRYWknWzTA0Bb/WUJo+TsgHz t/aM6pj1tmpaL2vWcqnyjO44cf4H5HaJvdepAXBUluGNKzzO3ms93t6Mjcl/Rr056um7w2W6hW8nY n22tAZhw==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9ZqU-0006lt-RF; Fri, 20 Apr 2018 17:29:15 +0000 Subject: Re: [PATCH 1/2] mm: introduce memory.min To: Roman Gushchin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, kernel-team@fb.com, Johannes Weiner , Michal Hocko , Vladimir Davydov , Tejun Heo References: <20180420163632.3978-1-guro@fb.com> <527af98a-8d7f-42ab-9ba8-71444ef7e25f@infradead.org> <20180420172039.GA4965@castle.DHCP.thefacebook.com> From: Randy Dunlap Message-ID: Date: Fri, 20 Apr 2018 10:29:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180420172039.GA4965@castle.DHCP.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/20/18 10:20, Roman Gushchin wrote: > > Hi, Randy! > > An updated version below. > > Thanks! OK, looks good now. Thanks. FWIW: Reviewed-by: Randy Dunlap # for Documentation/ only. > ------------------------------------------------------------ > > > From 2225fa0b3400431dd803f206b20a9344f0dfcd0a Mon Sep 17 00:00:00 2001 > From: Roman Gushchin > Date: Fri, 20 Apr 2018 15:24:44 +0100 > Subject: [PATCH 1/2] mm: introduce memory.min > > Memory controller implements the memory.low best-effort memory > protection mechanism, which works perfectly in many cases and > allows protecting working sets of important workloads from > sudden reclaim. > > But it's semantics has a significant limitation: it works > only until there is a supply of reclaimable memory. > This makes it pretty useless against any sort of slow memory > leaks or memory usage increases. This is especially true > for swapless systems. If swap is enabled, memory soft protection > effectively postpones problems, allowing a leaking application > to fill all swap area, which makes no sense. > The only effective way to guarantee the memory protection > in this case is to invoke the OOM killer. > > This patch introduces the memory.min interface for cgroup v2 > memory controller. It works very similarly to memory.low > (sharing the same hierarchical behavior), except that it's > not disabled if there is no more reclaimable memory in the system. > > Signed-off-by: Roman Gushchin > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Vladimir Davydov > Cc: Tejun Heo > --- > Documentation/cgroup-v2.txt | 24 ++++++++++- > include/linux/memcontrol.h | 15 ++++++- > include/linux/page_counter.h | 11 ++++- > mm/memcontrol.c | 99 ++++++++++++++++++++++++++++++++++++-------- > mm/page_counter.c | 63 ++++++++++++++++++++-------- > mm/vmscan.c | 19 ++++++++- > 6 files changed, 191 insertions(+), 40 deletions(-) > > diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt > index 657fe1769c75..a413118b9c29 100644 > --- a/Documentation/cgroup-v2.txt > +++ b/Documentation/cgroup-v2.txt > @@ -1002,6 +1002,26 @@ PAGE_SIZE multiple when read back. > The total amount of memory currently being used by the cgroup > and its descendants. > > + memory.min > + A read-write single value file which exists on non-root > + cgroups. The default is "0". > + > + Hard memory protection. If the memory usage of a cgroup > + is within its effective min boundary, the cgroup's memory > + won't be reclaimed under any conditions. If there is no > + unprotected reclaimable memory available, OOM killer > + is invoked. > + > + Effective low boundary is limited by memory.min values of > + all ancestor cgroups. If there is memory.min overcommitment > + (child cgroup or cgroups are requiring more protected memory > + than parent will allow), then each child cgroup will get > + the part of parent's protection proportional to its > + actual memory usage below memory.min. > + > + Putting more memory than generally available under this > + protection is discouraged and may lead to constant OOMs. > + > memory.low > A read-write single value file which exists on non-root > cgroups. The default is "0". > @@ -1013,9 +1033,9 @@ PAGE_SIZE multiple when read back. > > Effective low boundary is limited by memory.low values of > all ancestor cgroups. If there is memory.low overcommitment > - (child cgroup or cgroups are requiring more protected memory, > + (child cgroup or cgroups are requiring more protected memory > than parent will allow), then each child cgroup will get > - the part of parent's protection proportional to the its > + the part of parent's protection proportional to its > actual memory usage below memory.low. > > Putting more memory than generally available under this -- ~Randy