Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752449AbdI0QXq (ORCPT ); Wed, 27 Sep 2017 12:23:46 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:58901 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751879AbdI0QXl (ORCPT ); Wed, 27 Sep 2017 12:23:41 -0400 Date: Wed, 27 Sep 2017 17:23:00 +0100 From: Roman Gushchin To: Tim Hockin CC: Michal Hocko , Johannes Weiner , Tejun Heo , , David Rientjes , , Vladimir Davydov , Tetsuo Handa , Andrew Morton , Cgroups , , "linux-kernel@vger.kernel.org" Subject: Re: [v8 0/4] cgroup-aware OOM killer Message-ID: <20170927162300.GA5623@castle.DHCP.thefacebook.com> References: <20170925181533.GA15918@castle> <20170925202442.lmcmvqwy2jj2tr5h@dhcp22.suse.cz> <20170926105925.GA23139@castle.dhcp.TheFacebook.com> <20170926112134.r5eunanjy7ogjg5n@dhcp22.suse.cz> <20170926121300.GB23139@castle.dhcp.TheFacebook.com> <20170926133040.uupv3ibkt3jtbotf@dhcp22.suse.cz> <20170926172610.GA26694@cmpxchg.org> <20170927074319.o3k26kja43rfqmvb@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.0 (2017-09-02) X-Originating-IP: [2620:10d:c092:200::1:3ced] X-ClientProxiedBy: HE1PR05CA0209.eurprd05.prod.outlook.com (2603:10a6:3:f9::33) To CO1PR15MB1079.namprd15.prod.outlook.com (2a01:111:e400:7b66::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9242dac7-16ee-4717-9eb7-08d505c40f2b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:CO1PR15MB1079; X-Microsoft-Exchange-Diagnostics: 1;CO1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0DtHjN5Z9HE+Kdw71kNCT8qD1h5vp7qZmRIEgPedclhlpJwWE9fAj7JvhT6kcqPkdmBH3QnDTswz06cCeHFfpMB74KJU9bMEDK+sq/3q0y1dxGDT1VHKvRWTmghRldhjRNJhzmoF84IRXIM4wiYW+jv2M/4RfX4K4wYscCou/Zva0FLJe2Ca53TjHzJl8OZeuKuKOrEoYyCHDft1SL8CJrhLS4GyrglzWEczBjVZDtb7QrpYL60ojmbFBwP1tLV+R4sZNGi+P8VR+21+flzQRCO7o41vWq48ibmTeFZObvisQY/e+p2Ishdzsa0xcTXFQZxYOawdDELIeNq78ug/Q;4:dyIyYgtfSapJpf4eLAxB9x1cxpeOIJszcqFo5G3EH4ZJ19fvOljt0rRDH6eZQ8Nb7RlDwQe05E+DCML7IN7Iu9KdSQ9Hs47W0Qa5jXQoD7PNhpdZrPY3Z/X61ljE+l8xaVQYRuyjfeEVybJM+Hq6+9aTAXLkM0CRV6JSq4FFNN7AvdcHnVchN6Y4VgyxIO4A8ewcPoTCFRdd1OkyF6TFfFzO8qT0l4mkxtIpAgG60E7QUxVp+SN4cxt2PS/JS5mN X-Exchange-Antispam-Report-Test: UriScan:; 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)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CO1PR15MB1079;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CO1PR15MB1079; X-Forefront-PRVS: 04433051BF X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(346002)(376002)(377424004)(199003)(189002)(24454002)(377454003)(25786009)(316002)(39060400002)(6916009)(7416002)(54906003)(2950100002)(189998001)(8936002)(53546010)(229853002)(93886005)(6666003)(8676002)(47776003)(86362001)(53936002)(6246003)(68736007)(478600001)(1076002)(4326008)(101416001)(55016002)(6116002)(23726003)(305945005)(9686003)(5660300001)(97736004)(106356001)(6506006)(50466002)(105586002)(81166006)(81156014)(7736002)(83506001)(16586007)(50986999)(33656002)(58126008)(2906002)(54356999)(76176999)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB1079;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO1PR15MB1079;23:XzLfvORRc1ubRTSS59IhHStzdUnqomE6G/PPfeR0c?= =?us-ascii?Q?/6lcxle8VcFE0psgCztH/La/oWO0TCtuIwCb2KAiK7XRROzX3soRcikVEG0L?= =?us-ascii?Q?O5lwg5EhFNdJUUBUWT32avhNh4nrOKiB7W1789wLIK48sg+OoAtHfv396VSA?= =?us-ascii?Q?27zzGw70oKLff5XcAzP6UOGXPQCJiBLcTypQo8acZ+Uw4pvkNTDGW+KiR89U?= =?us-ascii?Q?pd3gwTmLcozE63cdXoITNjKcrWMaXWvOonQfYwDdGYFnpVUoWW/o3c22ehu3?= =?us-ascii?Q?tLVtyPItGJheT3k0ZdDdNsTP4tfSsRLlt0OgdDRj1FlabHkaJC1VWS+SaXy1?= =?us-ascii?Q?pfXq6aZI1sxGw98N+qu4Ca+1uRit8+yLiJbKOql2sBVbOBp3mhKm/srB9e3F?= =?us-ascii?Q?SzPR9sJR55rnL5Ixi2618mA2oeCqFaM7emXaURkZqlNtgTw0gPojM/bcio9S?= =?us-ascii?Q?ibw3gf/ROhUq3OZuQXgziJYJVoImq7zgDOzKpXUxKNf0eco2L9ZFapmt+NMi?= =?us-ascii?Q?id60/T5wMByam3e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/weeMt+i5NW3J+UxMEebLz1lw+2IBAE7O6mU1EUUm+pVhXvDvHLrLa4VsnQU1s2kE5rhch5J3ywPMKfZD+K2VS0DZG5nrdS/XjD/gH7cMwH7i1Udw2nIgxekW9NY96mf1ISawQn0NTanmcJUeEKVYf9glIuMWZ1YVU4T3L1N/JLjkDI3cd6utd3i6rk3aoM4QssJ17oa9LO6YCkmTMVWc6uMYxgqvxeP+PpnukADpQgknOilaY/XaQMdg==;5:yH3gpAlBSjqplVjH6Ud9qBu0TDoWVxHYJZnA6NxRcrkFcjEs0dTh0ZlLyJQsPzhOwZTWn2YKw778Zmq/PYTiW2HnfUdSp2N+6i0AK7WIWgd6gpJXxLZTb3ikXsTgPmLYb4Q4LkJJFW7A36Hphhq+Ig==;24:z9wK2fVUdTiEI0wZGJAnCZI9MZWCkGq1+MVkVCBdguFJ4fAZb+gACskCc8xck3Rs2LBu20Wa7OxkYcC5xMc8sZkdJAcHz6DGp8ffoXQvdMQ=;7:th1nTg+MRZIWssCQDvujtLKRuu3PjeDnzbCIlKdRbTg0xv8eYoH1bh6bU1pxipWq9q6wW09QuszSi0SaIKGnj+CqZJLGjMvcY8mmsQ3mcyF07z2TRFlFgnSzn25h7hgjnoaHG10CmeJBXSVCDul7AsC95Edr/FTIBnWNZnR5ydjtTqxQLUem61R6+7ZJazVFQTeGDWlag3LM+ZoKfG9vjsGAgfmPtBsjIKkB5wy5vyc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1079;20:aRncSzNo30wPtNjvOUpwgGOupZ5RCOKths3iSshKeNFQE10TwmLw7vcBAX5l/3s2YD8NhQ+uhiIRamvOteJNxy80tr+nnHIyNNO8NhqMpmc7/N+c6GGXViISG3nVOPT8KZ1opClCWrvSBWpwKuY2PtI0WLfzgproonjPoPmFgbY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2017 16:23:13.3881 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB1079 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-27_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3736 Lines: 74 On Wed, Sep 27, 2017 at 08:35:50AM -0700, Tim Hockin wrote: > On Wed, Sep 27, 2017 at 12:43 AM, Michal Hocko wrote: > > On Tue 26-09-17 20:37:37, Tim Hockin wrote: > > [...] > >> I feel like David has offered examples here, and many of us at Google > >> have offered examples as long ago as 2013 (if I recall) of cases where > >> the proposed heuristic is EXACTLY WRONG. > > > > I do not think we have discussed anything resembling the current > > approach. And I would really appreciate some more examples where > > decisions based on leaf nodes would be EXACTLY WRONG. > > > >> We need OOM behavior to kill in a deterministic order configured by > >> policy. > > > > And nobody is objecting to this usecase. I think we can build a priority > > policy on top of leaf-based decision as well. The main point we are > > trying to sort out here is a reasonable semantic that would work for > > most workloads. Sibling based selection will simply not work on those > > that have to use deeper hierarchies for organizational purposes. I > > haven't heard a counter argument for that example yet. > Hi, Tim! > We have a priority-based, multi-user cluster. That cluster runs a > variety of work, including critical things like search and gmail, as > well as non-critical things like batch work. We try to offer our > users an SLA around how often they will be killed by factors outside > themselves, but we also want to get higher utilization. We know for a > fact (data, lots of data) that most jobs have spare memory capacity, > set aside for spikes or simply because accurate sizing is hard. We > can sell "guaranteed" resources to critical jobs, with a high SLA. We > can sell "best effort" resources to non-critical jobs with a low SLA. > We achieve much better overall utilization this way. This is well understood. > > I need to represent the priority of these tasks in a way that gives me > a very strong promise that, in case of system OOM, the non-critical > jobs will be chosen before the critical jobs. Regardless of size. > Regardless of how many non-critical jobs have to die. I'd rather kill > *all* of the non-critical jobs than a single critical job. Size of > the process or cgroup is simply not a factor, and honestly given 2 > options of equal priority I'd say age matters more than size. > > So concretely I have 2 first-level cgroups, one for "guaranteed" and > one for "best effort" classes. I always want to kill from "best > effort", even if that means killing 100 small cgroups, before touching > "guaranteed". > > I apologize if this is not as thorough as the rest of the thread - I > am somewhat out of touch with the guts of it all these days. I just > feel compelled to indicate that, as a historical user (via Google > systems) and current user (via Kubernetes), some of the assertions > being made here do not ring true for our very real use cases. I > desperately want cgroup-aware OOM handing, but it has to be > policy-based or it is just not useful to us. A policy-based approach was suggested by Michal at a very beginning of this discussion. Although nobody had any strong objections against it, we've agreed that this is out of scope of this patchset. The idea of this patchset is to introduce an ability to select a memcg as an OOM victim with the following optional killing of all belonging tasks. I believe, it's absolutely mandatory for _any_ further development of the OOM killer, which wants to deal with memory cgroups as OOM entities. If you think that it makes impossible to support some use cases in the future, let's discuss it. Otherwise, I'd prefer to finish this part of the work, and proceed to the following improvements on top of it. Thank you!