From patchwork Mon May 11 22:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 11541849 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AF59913 for ; Mon, 11 May 2020 22:55:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC5F12070B for ; Mon, 11 May 2020 22:55:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="DBRJCAly" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC5F12070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 098B790008A; Mon, 11 May 2020 18:55:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 021E4900036; Mon, 11 May 2020 18:55:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E52D890008A; Mon, 11 May 2020 18:55:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id CACDB900036 for ; Mon, 11 May 2020 18:55:31 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8277240D6 for ; Mon, 11 May 2020 22:55:31 +0000 (UTC) X-FDA: 76805946462.29.road91_6a6455781945f X-Spam-Summary: 2,0,0,185faf723bd4d6c1,d41d8cd98f00b204,kuba@kernel.org,,RULES_HIT:41:355:379:541:800:966:967:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:1801:2196:2199:2393:2525:2559:2564:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4605:5007:6119:6261:6653:7875:7901:7903:8603:9025:10004:11026:11658:11914:12043:12295:12297:12438:12517:12519:12555:12679:12895:12986:13069:13161:13229:13255:13311:13357:13894:14181:14384:14394:14581:14721:21080:21450:21451:21627:21740:21749:21811:22013:30054:30070,0,RBL:198.145.29.99:@kernel.org:.lbl8.mailshell.net-62.2.0.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: road91_6a6455781945f X-Filterd-Recvd-Size: 2898 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 May 2020 22:55:30 +0000 (UTC) Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DBAE3206CC; Mon, 11 May 2020 22:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589237730; bh=pxjZnopLEhvVuE+hwn+nFyI+Zvw/0BY6mIaM+QZzV7A=; h=From:To:Cc:Subject:Date:From; b=DBRJCAly+tHOgZNaQm1yXJo14p3rpfNMkFGOf/JTiwFC8KbCSIDuK+9NMQxg1l1db 4n9EbIX9vjTGND0oaWj7Dv3rRevFAGRUoKVbP/3+fdsPCYOT3Qpf+I4c6kW1Zw3wYi 3uWV3g5tnzxSHDPldQgRgoZeKEb2DI88HJJ0u/kk= From: Jakub Kicinski To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, kernel-team@fb.com, tj@kernel.org, hannes@cmpxchg.org, chris@chrisdown.name, cgroups@vger.kernel.org, shakeelb@google.com, mhocko@kernel.org, Jakub Kicinski Subject: [PATCH mm v2 0/3] memcg: Slow down swap allocation as the available space gets depleted Date: Mon, 11 May 2020 15:55:13 -0700 Message-Id: <20200511225516.2431921-1-kuba@kernel.org> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Tejun describes the problem as follows: When swap runs out, there's an abrupt change in system behavior - the anonymous memory suddenly becomes unmanageable which readily breaks any sort of memory isolation and can bring down the whole system. To avoid that, oomd [1] monitors free swap space and triggers kills when it drops below the specific threshold (e.g. 15%). While this works, it's far from ideal: - Depending on IO performance and total swap size, a given headroom might not be enough or too much. - oomd has to monitor swap depletion in addition to the usual pressure metrics and it currently doesn't consider memory.swap.max. Solve this by adapting parts of the approach that memory.high uses - slow down allocation as the resource gets depleted turning the depletion behavior from abrupt cliff one to gradual degradation observable through memory pressure metric. [1] https://github.com/facebookincubator/oomd v1: https://lore.kernel.org/linux-mm/20200417010617.927266-1-kuba@kernel.org/ Jakub Kicinski (3): mm: prepare for swap over-high accounting and penalty calculation mm: move penalty delay clamping out of calculate_high_delay() mm: automatically penalize tasks with high swap use Documentation/admin-guide/cgroup-v2.rst | 16 +++ include/linux/memcontrol.h | 4 + mm/memcontrol.c | 166 ++++++++++++++++++------ 3 files changed, 147 insertions(+), 39 deletions(-)