Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934013AbbLPDTG (ORCPT ); Tue, 15 Dec 2015 22:19:06 -0500 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:60629 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933900AbbLPDTE (ORCPT ); Tue, 15 Dec 2015 22:19:04 -0500 X-SecurityPolicyCheck: OK by SHieldMailChecker v2.3.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20150223 X-SHieldMailCheckerMailID: 3dde3971868c46abae2b8f5cb88ab4c0 Subject: Re: [PATCH 1/7] mm: memcontrol: charge swap to cgroup2 To: Johannes Weiner References: <265d8fe623ed2773d69a26d302eb31e335377c77.1449742560.git.vdavydov@virtuozzo.com> <20151214153037.GB4339@dhcp22.suse.cz> <20151214194258.GH28521@esperanza> <566F8781.80108@jp.fujitsu.com> <20151215145011.GA20355@cmpxchg.org> Cc: Vladimir Davydov , Michal Hocko , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org From: Kamezawa Hiroyuki Message-ID: <5670D806.60408@jp.fujitsu.com> Date: Wed, 16 Dec 2015 12:18:30 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151215145011.GA20355@cmpxchg.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2166 Lines: 49 On 2015/12/15 23:50, Johannes Weiner wrote: > On Tue, Dec 15, 2015 at 12:22:41PM +0900, Kamezawa Hiroyuki wrote: >> On 2015/12/15 4:42, Vladimir Davydov wrote: >>> Anyway, if you don't trust a container you'd better set the hard memory >>> limit so that it can't hurt others no matter what it runs and how it >>> tweaks its sub-tree knobs. >> >> Limiting swap can easily cause "OOM-Killer even while there are available swap" >> with easy mistake. Can't you add "swap excess" switch to sysctl to allow global >> memory reclaim can ignore swap limitation ? > > That never worked with a combined memory+swap limit, either. How could > it? The parent might swap you out under pressure, but simply touching > a few of your anon pages causes them to get swapped back in, thrashing > with whatever the parent was trying to do. Your ability to swap it out > is simply no protection against a group touching its pages. > > Allowing the parent to exceed swap with separate counters makes even > less sense, because every page swapped out frees up a page of memory > that the child can reuse. For every swap page that exceeds the limit, > the child gets a free memory page! The child doesn't even have to > cause swapin, it can just steal whatever the parent tried to free up, > and meanwhile its combined memory & swap footprint explodes. > Sure. > The answer is and always should have been: don't overcommit untrusted > cgroups. Think of swap as a resource you distribute, not as breathing > room for the parents to rely on. Because it can't and could never. > ok, don't overcommmit. > And the new separate swap counter makes this explicit. > Hmm, my requests are - set the same capabilities as mlock() to set swap.limit=0 - swap-full notification via vmpressure or something mechanism. - OOM-Killer's available memory calculation may be corrupted, please check. - force swap-in at reducing swap.limit Thanks, -Kame -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/