Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbdIDRvy (ORCPT ); Mon, 4 Sep 2017 13:51:54 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:38010 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753951AbdIDRvu (ORCPT ); Mon, 4 Sep 2017 13:51:50 -0400 Date: Mon, 4 Sep 2017 18:51:18 +0100 From: Roman Gushchin To: Shakeel Butt CC: Linux MM , Michal Hocko , Vladimir Davydov , Johannes Weiner , Tetsuo Handa , David Rientjes , Andrew Morton , Tejun Heo , , , , LKML Subject: Re: [v7 5/5] mm, oom: cgroup v2 mount option to disable cgroup-aware OOM killer Message-ID: <20170904175118.GA25219@castle.DHCP.thefacebook.com> References: <20170904142108.7165-1-guro@fb.com> <20170904142108.7165-6-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Originating-IP: [2620:10d:c092:200::1:6ef9] X-ClientProxiedBy: DB6PR07CA0091.eurprd07.prod.outlook.com (2603:10a6:6:2b::29) To DM3PR15MB1082.namprd15.prod.outlook.com (2603:10b6:0:12::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a61aaa4c-46e6-4c0e-df6d-08d4f3bd9292 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM3PR15MB1082; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1082;3:JNzhiFH+NOZ3B5c9v0M1tL5rmqsPo6Il+MoXraMNAeORgOrVWJ7ChsksmfcMDiSXW9q3J1J57IU32a+ekwZVjYMTu2d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2RvnyntGOoUFT1nMPGHFS6RQoAeD0za072ayrGkrspIF2nC0RJkrFWNFsx1hlsnlETIfB2awp3exG612SvQX6zGWJ1OPfc6IKM7e2hSsLJNVGuT93iMiZvmLTPjwLTqmnfgzZsx7YnDvgc7KP478x6Jdhs6T1LAAQjbJsG5x796ffnt1VowKZHCPqMJUeXVpX/cPrS0AB6yVnNR7h6I+qJ1gmvUsOHQ7zITTqVw/A9A1DwY0eK+5HAnrnFW;4:58rUhFim/SdeTc/SywQzj3jc7+6No5MDrv+WaPFymbkAkmMWup33/Tr7gR49xLYxlOWBq3rKyDh0NVB+jB6+rrnQ6Y1YmA1HzhmauaNkyRttK6nrPap9U5U2e3DkSNc5VG49LYElD6QVwhnXLjrtqZWARaTyFgcBxK6BeJz/nBc5pG2HKbwpl3w1hA33b9cWyIl4bTyVT+hUd+cre/+ezMFieYJg1uHwm1+OpALe4ePY3oxZ4iitU2xEbU8jJCYdcGwQJUWYzSQLYR96yTl8YEEa9w2iSuDVYFCaoz1uquXH+rDEZs1ModYdlM9roFTaK9a851jWU8IglvqDkf6RRuar7hwsMcoVhDGQXC9dO20PofdZBANwz+OUOFP6GHfrM9kpxku4tgpUPswh2tBSrQ== X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(67672495146484)(211936372134217)(153496737603132); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(920507026)(6041248)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR15MB1082;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR15MB1082; X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(377454003)(199003)(189002)(39060400002)(8676002)(6116002)(2906002)(7736002)(101416001)(110136004)(50986999)(53546010)(8936002)(50466002)(53936002)(305945005)(97736004)(81156014)(1076002)(23726003)(81166006)(6916009)(2950100002)(105586002)(6666003)(83506001)(229853002)(25786009)(4326008)(7416002)(5660300001)(6506006)(68736007)(34040400001)(33656002)(106356001)(55016002)(54906002)(86362001)(575784001)(47776003)(4001350100001)(6246003)(76176999)(54356999)(9686003)(478600001)(189998001)(42186005)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1082;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1082;23:kQAfGalwcAPPzh/cXj8haExeMWEe9jIa3n4glPzmH?= =?us-ascii?Q?lr7WHNU9P3yK67JvdyLWJxBmBK7Xh52HhOv8Vp6djCdVoksx+7usTrU216Tj?= =?us-ascii?Q?F0gX7SlUDVT/vYsJx+/JTbHdWfFk3TPv1XaD6zbK7759VwFd8U0PPOO7Z/NO?= =?us-ascii?Q?6UWK+FY0hiPuypU0huItgabyEYv6MD5ddpNfyezi1W+UYS79AGvQq3fngN9x?= =?us-ascii?Q?wOHGumQh4xMnA0ImJpcMk1RSO4lX7dil6o/02iRTHUmWCZWUi6WsCDO700Cf?= =?us-ascii?Q?QH8USXnCzKzrupufIgA6Fp3u1wUtjrsSW+22N9PkieTeMx/h0pCYGxJ0b+/u?= =?us-ascii?Q?XV5+rmJ6iC9dSJlxGk7e5KtG6aX9bNpW0rrdLev48VDXya/za9Xnyxec2nqD?= =?us-ascii?Q?iaYomQ/Pwk6Vkg+r74AgZPJ73057sbefmNjGwOLNbV0E0fuKnZOlemZvbPrk?= =?us-ascii?Q?v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E= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 17:51:28.0643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1082 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-04_11:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3582 Lines: 106 On Mon, Sep 04, 2017 at 10:32:37AM -0700, Shakeel Butt wrote: > On Mon, Sep 4, 2017 at 7:21 AM, Roman Gushchin wrote: > > Introducing of cgroup-aware OOM killer changes the victim selection > > algorithm used by default: instead of picking the largest process, > > it will pick the largest memcg and then the largest process inside. > > > > This affects only cgroup v2 users. > > > > To provide a way to use cgroups v2 if the old OOM victim selection > > algorithm is preferred for some reason, the nogroupoom mount option > > is added. > > Is this mount option or boot parameter? From the code, it seems like a > boot parameter. Sure, you're right. Fixed version below. Thank you! -- >From 0b4757ec8d339fa883e17d4e25a92f45bf5565e0 Mon Sep 17 00:00:00 2001 From: Roman Gushchin Date: Mon, 4 Sep 2017 12:08:52 +0100 Subject: [v7 5/5] mm, oom: allow disabling cgroup-aware OOM killer Introducing of cgroup-aware OOM killer changes the victim selection algorithm used by default: instead of picking the largest process, it will pick the largest memcg and then the largest process inside. This affects only cgroup v2 users. To provide a way to use cgroups v2 if the old OOM victim selection algorithm is preferred for some reason, the cgroup.memory=nogroupoom boot option is added. If set, the OOM selection is performed in a "traditional" per-process way. Both oom_priority and oom_group memcg knobs are ignored. Signed-off-by: Roman Gushchin Cc: Michal Hocko Cc: Vladimir Davydov Cc: Johannes Weiner Cc: Tetsuo Handa Cc: David Rientjes Cc: Andrew Morton Cc: Tejun Heo Cc: kernel-team@fb.com Cc: cgroups@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- Documentation/admin-guide/kernel-parameters.txt | 1 + mm/memcontrol.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 28f1a0f84456..07891f1030aa 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -489,6 +489,7 @@ Format: nosocket -- Disable socket memory accounting. nokmem -- Disable kernel memory accounting. + nogroupoom -- Disable cgroup-aware OOM killer. checkreqprot [SELINUX] Set initial checkreqprot flag value. Format: { "0" | "1" } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d7dd293897ca..6a8235dc41f6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -87,6 +87,9 @@ static bool cgroup_memory_nosocket; /* Kernel memory accounting disabled? */ static bool cgroup_memory_nokmem; +/* Cgroup-aware OOM disabled? */ +static bool cgroup_memory_nogroupoom; + /* Whether the swap controller is active */ #ifdef CONFIG_MEMCG_SWAP int do_swap_account __read_mostly; @@ -2822,6 +2825,9 @@ bool mem_cgroup_select_oom_victim(struct oom_control *oc) if (mem_cgroup_disabled()) return false; + if (cgroup_memory_nogroupoom) + return false; + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) return false; @@ -6188,6 +6194,8 @@ static int __init cgroup_memory(char *s) cgroup_memory_nosocket = true; if (!strcmp(token, "nokmem")) cgroup_memory_nokmem = true; + if (!strcmp(token, "nogroupoom")) + cgroup_memory_nogroupoom = true; } return 0; } -- 2.13.5