Received: by 10.192.165.148 with SMTP id m20csp3383344imm; Mon, 23 Apr 2018 05:47:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MY6qNYsoA4j9eggEJMldvWawROwPfUfxjRUsUkcs+UBbhH8AnhgHkQI7nDk9djekhbVcH X-Received: by 10.98.88.194 with SMTP id m185mr19501775pfb.167.1524487665526; Mon, 23 Apr 2018 05:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524487665; cv=none; d=google.com; s=arc-20160816; b=vFHgLotQtOeG1Bos1zikvSQXm2mdTwihbpVI3EKA8J+swuwZdeQw1Jl8Rghn0OPU2l SG4+QNLKH/S/7w1XO+Ak89s3K3Da2nnBQDiDu4vnWQqh+dRjNnQNJkXzbxJs6kO3EfY3 pBu5tVKw1O3hxRF2viW+mTVjK1YwQpRTGBnAvZMPIjxyfaYWd3mHUhwKQGjk0Ka23eww 0E5/PIpikeALeyomjdwV4A1L/4hljWP7jwr9uf3IqepxffvOgBx1Aq/Bn83d5LjHAFid 0lCckdzlVUYBS3VoBRX2g9qwks73xs3Dja7Q2mNTT6aKnwAMGcaF9EaAYlvWuWgZtor4 L7Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=7kY58nSdq+7ASkvMYNeoJChudxQRFxBWFeK597t6JE0=; b=tuz57gT1AuL80BHmHlqGV/GOwyHneSlvB9H2GsJG+UIwg3qNx/XZ6L5XmdZV9iG//U zXQkkQO13E+C71ji5NZQPp1f1g6D/QMQ2p0W2OEFTw+9VTDw8Ylu1c84WpJ3xXMdMYb1 BCXN0qgCDvmfYXPolm1tgP6/Nxnwtn5PhPPIFoIxreGVjnt418jbiLQgamEdOvRbFbNG iTYomxNxti0Vmctz14ugDexhL6KHWwbPnfqO4AXPQm+Nd/avgyIz6pVZ/IW28q+lmEhD b7QImF4hncxPiykn5vvMO3oFdOLwldEbVukENsCTgLNBrXFdqBDe5oibF+uOBDVXaqfy txUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=hl6CQK2P; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=RA1k6lam; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si9604658pgs.685.2018.04.23.05.47.30; Mon, 23 Apr 2018 05:47:45 -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=pass header.i=@fb.com header.s=facebook header.b=hl6CQK2P; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=RA1k6lam; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755205AbeDWMpT (ORCPT + 99 others); Mon, 23 Apr 2018 08:45:19 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:58868 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754852AbeDWMpP (ORCPT ); Mon, 23 Apr 2018 08:45:15 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3NCg4I5019627; Mon, 23 Apr 2018 05:45:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=7kY58nSdq+7ASkvMYNeoJChudxQRFxBWFeK597t6JE0=; b=hl6CQK2PZwfXYLstrQtL72FVoOpLUADEYCYKGXGqyFJ9K3eEkP0ISmHers8YZ9H3seXM cnH86/M41ueSC7nxPsHEKbgSHAO16VNoJAootpCVEsO5P3vah7baNoWTBWY9qCE0uigl RuajKFXmce/4icJAko7JEZclnDAzrcakPOY= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2hhep484pv-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Apr 2018 05:45:06 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.21) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 23 Apr 2018 08:45:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7kY58nSdq+7ASkvMYNeoJChudxQRFxBWFeK597t6JE0=; b=RA1k6lamLo4G0XVFMCHs/J03qtlJCEL+61bkGOr/uX/n0Pfy2x3Xi4SNslOzO+EHppxBGHX37XRnjDBUuFcYG72K5CH4fLGbZtCSFgzr/2QFVVj+pAqs1FZES3ssyLMftNpTzQ22rKUaMm/MaXUiA1R/Cs+0IyRvOTifwfWIyr4= Received: from castle.DHCP.thefacebook.com (2620:10d:c092:200::1:b3a9) by SN2PR15MB1088.namprd15.prod.outlook.com (2603:10b6:804:22::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Mon, 23 Apr 2018 12:44:59 +0000 Date: Mon, 23 Apr 2018 13:44:43 +0100 From: Roman Gushchin To: Johannes Weiner CC: , , , , Michal Hocko , Vladimir Davydov , Tejun Heo Subject: Re: [PATCH 1/2] mm: introduce memory.min Message-ID: <20180423124442.GB29016@castle.DHCP.thefacebook.com> References: <20180420163632.3978-1-guro@fb.com> <20180420204429.GA24563@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180420204429.GA24563@cmpxchg.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [2620:10d:c092:200::1:b3a9] X-ClientProxiedBy: DB6PR0301CA0065.eurprd03.prod.outlook.com (2603:10a6:4:54::33) To SN2PR15MB1088.namprd15.prod.outlook.com (2603:10b6:804:22::10) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN2PR15MB1088; X-Microsoft-Exchange-Diagnostics: 1;SN2PR15MB1088;3:ZccWlOuGwEozC4aQryB8egtCuOzzgJGLMj5b6Bt2ciJZNobrwiYi80Vvi9pJczT5+loLqxeBb+FzFhQuSiBGWO/drb9TBBWjrUQ50DtMN56wSNzDS+eM1KuzEwW43JDXzLLH7bQ6RMT30MxjdTQyXb/1LXW1U95XTVN+38d6dDFRlXqoEoJq3EyaNgfT6a8MR0tQx4AbB91i1GPU7FpIqnSY2MxB12Xz83Na+YXNDS/Qsi0YeDVUKEqKAHN9fyz6;25:BlLNzKD8hGRnIVZbzEXzPt6egmDD5/bbaaq4zP2ytNtGCeo9pn7tfrL+OgEyv6jeN6TUskm3csMVZ7LnqTJsNJKiswil2ivzo0KSafkqZKnCG7TfEqCdb4PNLpW98vNl4BGGLkxR0s3u83HtdO8iGwuo3G5mhCs5sfCJ2jVKuRm2HjzJfTWzRUf+owiU6NyywZxHJPkd4SXEA0krKdJFyJJlRTVGkjBMzSeB7EAd66U9KyD3SnK6fvKD3Oqfoc73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8QIzm8j4xl+VVm0soilZ5gmibdZx6kF6PtX3uGpS5IXmSal5Ls4poUYIj+6+SSnjCHpimGEYINHYTlH38kJcTYDAHY648ryA3s2iOHSBXQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231232)(11241501184)(944501410)(52105095)(3002001)(10201501046)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:SN2PR15MB1088;BCL:0;PCL:0;RULEID:;SRVR:SN2PR15MB1088; X-Forefront-PRVS: 06515DA04B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(376002)(39380400002)(39860400002)(396003)(346002)(366004)(51914003)(54534003)(316002)(47776003)(9686003)(58126008)(16586007)(55016002)(54906003)(33656002)(8936002)(16526019)(81166006)(52396003)(59450400001)(76176011)(7696005)(52116002)(5660300001)(8676002)(1076002)(6116002)(23726003)(386003)(6506007)(7736002)(229853002)(6916009)(6666003)(50466002)(39060400002)(53936002)(6246003)(305945005)(186003)(4326008)(446003)(86362001)(46003)(11346002)(478600001)(2906002)(25786009)(476003)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN2PR15MB1088;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;LANG:en;MLV:ovrnspm;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR15MB1088;23:irOP1NI7fVHiZEWUZkT+pHW31RZMrsgKYvcABJA9W?= =?us-ascii?Q?2N+EibmyQtWnRMc10si+mUbe5EYcX9g1eq2jew/HVQvnng4H4qz/ujqhbJBy?= =?us-ascii?Q?2U/TkF8FesjLOe+MElWT9SD3GN3W+Kn8Ed3TC6b6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aDSOjYTa/XnnThlInZnlwABFY4R/B3btj+TptcTZVyI=;24:zwf3q/5B+JP5JP2SgvuBctAw06T4CnX0dGay3I97n5VWbyLTVbD1N4mjvGd785xPWMNSod3xuySUq0BJOBvP4lZb0C8UUoB5kQEWp3L7EDk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN2PR15MB1088;7:3BXuMGtlItbJxhvwiel7Ezx9mRxrRIq7suMrqYeMRGxZXuz0Qb7SS7FxPZSRJHry12gHPgOprlIBKR6z91Wk577NcXBL+zN/PK0c79QXiagb8Vt6JBQYGT6X9qSva7PLtMsERS3Y+7Y4yTjLNGYUEmZCOpoEFWcA5hapKePNIhnMjXvrPSK+zXRl+vad3BCYmORnKNPVz22FoT6TURBdIoGWxDbi8srXXHxFbPyTBop81lSPdlgwTP3d9sqV6zl7;20:pGh86btiDq5rgdoHE/pHa00fpOJ35B+g6rzEAt9ZmItOBpMupW4CLLoWjhq/06QJ9nLEUgI86rmwnmLfwWATLeETjCCt1RbcdEf0SJiraJLv+Cuwcmd20YHFWNxQUjetD9Brxp73Ew5PH9tyGLZpjgva/rEgBwpEzzz+GNkNpBk= X-MS-Office365-Filtering-Correlation-Id: b9411a5c-1975-41c2-ad8a-08d5a9180703 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2018 12:44:59.1189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9411a5c-1975-41c2-ad8a-08d5a9180703 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR15MB1088 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-23_05:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johannes! Thanks for the review. I've just sent v2, which closely follows your advice, really nothing contradictory. Plus fixed some comments on top of mem_cgroup_protected and fixed !CONFIG_MEMCG build. Thank you! Roman On Fri, Apr 20, 2018 at 04:44:29PM -0400, Johannes Weiner wrote: > Hi Roman, > > this looks cool, and the implementation makes sense to me, so the > feedback I have is just smaller stuff. > > On Fri, Apr 20, 2018 at 05:36:31PM +0100, Roman Gushchin wrote: > > 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 > > its > > > only until there is a supply of reclaimable memory. > > s/until/as long as/ > > Maybe "as long as there is an unprotected supply of reclaimable memory > from other groups"? > > > 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 makes it sound like it has no purpose at all. But like with > memory.high, the point is to avoid the kernel OOM killer, which knows > jack about how the system is structured, and instead allow userspace > management software to monitor MEMCG_LOW and make informed decisions. > > memory.min again is the fail-safe for memory.low, not the primary way > of implementing guarantees. > > > @@ -297,7 +297,14 @@ static inline bool mem_cgroup_disabled(void) > > return !cgroup_subsys_enabled(memory_cgrp_subsys); > > } > > > > -bool mem_cgroup_low(struct mem_cgroup *root, struct mem_cgroup *memcg); > > +enum mem_cgroup_protection { > > + MEM_CGROUP_UNPROTECTED, > > + MEM_CGROUP_PROTECTED_LOW, > > + MEM_CGROUP_PROTECTED_MIN, > > +}; > > These look a bit unwieldy. How about > > MEMCG_PROT_NONE, > MEMCG_PROT_LOW, > MEMCG_PROT_HIGH, > > > +enum mem_cgroup_protection > > +mem_cgroup_protected(struct mem_cgroup *root, struct mem_cgroup *memcg); > > Please don't wrap at the return type, wrap the parameter list instead. > > > int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm, > > gfp_t gfp_mask, struct mem_cgroup **memcgp, > > @@ -756,6 +763,12 @@ static inline void memcg_memory_event(struct mem_cgroup *memcg, > > { > > } > > > > +static inline bool mem_cgroup_min(struct mem_cgroup *root, > > + struct mem_cgroup *memcg) > > +{ > > + return false; > > +} > > + > > static inline bool mem_cgroup_low(struct mem_cgroup *root, > > struct mem_cgroup *memcg) > > { > > The real implementation has these merged into the single > mem_cgroup_protected(). Probably a left-over from earlier versions? > > It's always a good idea to build test the !CONFIG_MEMCG case too. > > > @@ -5685,44 +5723,71 @@ struct cgroup_subsys memory_cgrp_subsys = { > > * for next usage. This part is intentionally racy, but it's ok, > > * as memory.low is a best-effort mechanism. > > */ > > -bool mem_cgroup_low(struct mem_cgroup *root, struct mem_cgroup *memcg) > > +enum mem_cgroup_protection > > +mem_cgroup_protected(struct mem_cgroup *root, struct mem_cgroup *memcg) > > Please fix the wrapping here too. > > > @@ -2525,12 +2525,29 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) > > unsigned long reclaimed; > > unsigned long scanned; > > > > - if (mem_cgroup_low(root, memcg)) { > > + switch (mem_cgroup_protected(root, memcg)) { > > + case MEM_CGROUP_PROTECTED_MIN: > > + /* > > + * Hard protection. > > + * If there is no reclaimable memory, OOM. > > + */ > > + continue; > > + > > + case MEM_CGROUP_PROTECTED_LOW: > > Please drop that newline after continue. > > > + /* > > + * Soft protection. > > + * Respect the protection only until there is > > + * a supply of reclaimable memory. > > Same feedback here as in the changelog: > > s/until/as long as/ > > Maybe "as long as there is an unprotected supply of reclaimable memory > from other groups"? > > > + */ > > if (!sc->memcg_low_reclaim) { > > sc->memcg_low_skipped = 1; > > continue; > > } > > memcg_memory_event(memcg, MEMCG_LOW); > > + break; > > + > > + case MEM_CGROUP_UNPROTECTED: > > Please drop that newline after break, too. > > Thanks! > Johannes