Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2247294imc; Tue, 12 Mar 2019 09:50:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqynbiRiXdw284HKC64/AXMBsxrQQxdp37W5g8pk5GLzqhRz5yULuvTYb/dgDfZbwiS594yx X-Received: by 2002:a65:6559:: with SMTP id a25mr25316743pgw.99.1552409404059; Tue, 12 Mar 2019 09:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552409404; cv=none; d=google.com; s=arc-20160816; b=z1+VwW0cgsSa37qBFVis14lJ+AcXcJ8fdgHND4c2ltof8/alEsPKpywb60xA8xrXvX DDEOD56gRJlRDuhwgGog2UQ+IhVA4FdckjnyGIgCSLrBCzM0j2uVB2A9PrspTq1S+Ioz GFXK8WXLvTV5Hs5VHN7Rk6DK1JcrXxODX4aJCqUK11nl2Iab3W9JvARYDDQygA+wzTah HMCM95CFNQA8MqYXUsK9Xd1Gxba7doSWCrC8on9DLnxgPbSyGtcluc6aJt2IecZ/6LMh U7Z/X3SNQgYYkSt4yBqGVr2HP04KP4/a94wMl3Y2C8hW10DITx7HnHnR8cKRhKSxtp7Q 1bRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+5duUyg2h3TIcoE6yBK501y/vGBGxqa7lpnsuVb7M6s=; b=k5ivb80GoZ1clvq1SifRGGAsPpysoFz/HcIaovp8LbZJd6UWQgEeecAGJUzXkSWe07 X93bUgw6BVkUcizI3XP8zunnprgk6sG+LvK0JDbGZeXXlOKFYrdCdWXH/l0tRG+JUQs2 PZmubny3CBGR2eXbbXbyGiYQGaQ21mUdZ+KRLUk8bdz04gP4URKD3dgpeCBL+D1Sw1qx uei7sU6S9Smsa37w8Qo1jULfEVVjjRILBioWTD1JZPMgrWu7FQrnBuge4T9ixDpAOP8V EH4lTMc3NgI7hftuNQ/V0NM3er8G1pGVTk/imzCf8nl8OZ8WRi8sleQnvNfXkDW26IRE KQrw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x17si7914528pgg.431.2019.03.12.09.49.47; Tue, 12 Mar 2019 09:50:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbfCLQtA (ORCPT + 99 others); Tue, 12 Mar 2019 12:49:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:58658 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726141AbfCLQs7 (ORCPT ); Tue, 12 Mar 2019 12:48:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F914AFE8; Tue, 12 Mar 2019 16:48:58 +0000 (UTC) Date: Tue, 12 Mar 2019 17:48:57 +0100 From: Michal Hocko To: Sultan Alsawaf Cc: Suren Baghdasaryan , Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Ingo Molnar , Peter Zijlstra , LKML , devel@driverdev.osuosl.org, linux-mm , Tim Murray Subject: Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android Message-ID: <20190312164857.GE5721@dhcp22.suse.cz> References: <20190310203403.27915-1-sultan@kerneltoast.com> <20190311174320.GC5721@dhcp22.suse.cz> <20190311175800.GA5522@sultan-box.localdomain> <20190311204626.GA3119@sultan-box.localdomain> <20190312080532.GE5721@dhcp22.suse.cz> <20190312163741.GA2762@sultan-box.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190312163741.GA2762@sultan-box.localdomain> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 12-03-19 09:37:41, Sultan Alsawaf wrote: > On Tue, Mar 12, 2019 at 09:05:32AM +0100, Michal Hocko wrote: > > The only way to control the OOM behavior pro-actively is to throttle > > allocation speed. We have memcg high limit for that purpose. Along with > > PSI, I can imagine a reasonably working user space early oom > > notifications and reasonable acting upon that. > > The issue with pro-active memory management that prompted me to create this was > poor memory utilization. All of the alternative means of reclaiming pages in the > page allocator's slow path turn out to be very useful for maximizing memory > utilization, which is something that we would have to forgo by relying on a > purely pro-active solution. I have not had a chance to look at PSI yet, but > unless a PSI-enabled solution allows allocations to reach the same point as when > the OOM killer is invoked (which is contradictory to what it sets out to do), > then it cannot take advantage of all of the alternative memory-reclaim means > employed in the slowpath, and will result in killing a process before it is > _really_ necessary. If you really want to reach the real OOM situation then you can very well rely on the in-kernel OOM killer. The only reason you want a customized oom killer is the tasks clasification. And that is a different story. User space hints on the victim selection has been a topic for quite while. It never get to any conclusion as interested parties have always lost an interest because it got hairy quickly. > > If you design is relies on the speed of killing then it is fundamentally > > flawed AFAICT. You cannot assume anything about how quickly a task dies. > > It might be blocked in an uninterruptible sleep or performin an > > operation which takes some time. Sure, oom_reaper might help here but > > still. > > In theory we could instantly zap any process that is not trapped in the kernel > at the time that the OOM killer is invoked without any consequences though, no? No, this is not so simple. Have a look at the oom_reaper and hops it has to go through. -- Michal Hocko SUSE Labs