Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1411398imc; Mon, 11 Mar 2019 13:11:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKQgTrEuQY5g+Ifu/mZvy5beSlxBs7j5IcJrO28O3IpuXlJ/epYNDE3+6KNdKaAw0zqJeF X-Received: by 2002:a63:5d64:: with SMTP id o36mr6712942pgm.322.1552335084379; Mon, 11 Mar 2019 13:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552335084; cv=none; d=google.com; s=arc-20160816; b=hGoWT8rogDRLLrG0g8gwe1AXRW93vUiy4va4upE+ZUtpAjGy2NfUHuUpBBDJQ6xkii v6AeyWwDO6vKEg0fIGazb5+ofLn6YiBFUWgDS+/7qwpL9kDsM3kr5mTugMSMYP8nEksM l+//WU/bZSxO8kqVzcZrXYiEWwQcoy/sM3AWlL2wP8F1huRIRlti5m7HknDuLrpVh2O7 IofGc69tyA2SM0PwtY9rfQ4ZJqQbTbvjrpttaH4FwAyEsVeOYVJcwcAFFvkiKsM21TkQ Mt74nHYsh4yyYehl6f8St7eUezrVgW4D6mxNrVjGnFJIh49ArL6pJAMnwVcXGJC8ImiS /bbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZKCjSMCXnbl4Pu4JXE4MWbjLrTVkbghT9J2ILGHq6Q8=; b=XAqcjoMMqWRmPesn4+PHawp5LN4lBGiGxS3Ql0M7vPliNT46plpbkBvmiUOsGoA5Mu jOUeN3Oqax025IR7RixsoND6fOuj02wMEY2iJXWdvUH6myLGsDh0FpgAh+GsuzSmKSF9 DVyQYSCKv7ELbiV33tkBARDJ7iA9iwgLgWtY+VsacbAlpjGKrI+PzPTG9GcHeHBIt28D ZFVxczbaCEClNBlxCobdAZpXgGwzJKkZnA01nZvKisRpWH5xsiCsBxYCE5Q1BGuVmHnt GKnUZSpvPO3J2G/Jp2u2rvXP3A2foS3U9p9JvTMDgPGPLtFCyw4Z9oBpQzLkEww3ECOW Ox1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZoyMlSr4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si6121087plo.274.2019.03.11.13.11.07; Mon, 11 Mar 2019 13:11:24 -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=@google.com header.s=20161025 header.b=ZoyMlSr4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728867AbfCKUKv (ORCPT + 99 others); Mon, 11 Mar 2019 16:10:51 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35797 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728713AbfCKUKu (ORCPT ); Mon, 11 Mar 2019 16:10:50 -0400 Received: by mail-wm1-f67.google.com with SMTP id y15so415195wma.0 for ; Mon, 11 Mar 2019 13:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZKCjSMCXnbl4Pu4JXE4MWbjLrTVkbghT9J2ILGHq6Q8=; b=ZoyMlSr4ebBY08p033osdVOmkU3R9VXs9CSVj/pQyFonxmrwtnSc0LmAVDsfbgP55D ddEnaeZ6ws19K7QMY4nRzaczDzZkCQCCyshQblMFWRu/p9vnvksfGlqiQpzEWPHfCHAv O2QKUZQ7GMZW0nuLBwPK3KFK9befY91P4bUk0zbAfc1mZTDhSKU6nSdb6IQtUIcVtNPs sdHDJ1Egdru01rBhc3N8MHLdIOhSc/XihtaTUrpIfYIttNUT91ca27+5fhDDVQZbXno4 v5hFaJkbB8G0d4TGxibTSjoLPjvodmj+RX42iAMEJHe+K4qc+Nygj0cw9soZ+ous0rok fIAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZKCjSMCXnbl4Pu4JXE4MWbjLrTVkbghT9J2ILGHq6Q8=; b=USa7Z8hz2yh+14V1ZZ6nv/ZqfSqeUwWrrx8nDyIJq34K1Yqop6uHDhLlc/tESgTxOV B0HkHaJSIh8use+ZEx65n6WZ2hmEUbjFNhvheZ1TegYNJIwQRR158Aq6hXtOXMnW0e1g Oryq1OGpCf+cMZ3bxszYyyoxGjHWSl8CXYS52GeAG1gQpL16NBbXbPPVxuZ/dola/eXa T5QpRVoU21zeye90yMLa3dLrEfkSLsbQGA93FzRedmeygnF8AbU280IQDCf7FkXs07SO sxkWHhCccesX2ooVwcKrQSoH/Kw+lUX9aDEpJOleX/dEI77JpmawurCkZmFNM/XTfFDk 9dFw== X-Gm-Message-State: APjAAAV9kVM1eYIhCY4ILhgKOerwxLQ8NMeVrvEcZ9wQM+0jrhqRFbUO 0hPFuN/C+hGS+tyRlqFg1J/W/q3zZhYoOYqGMCleEA== X-Received: by 2002:a1c:20d3:: with SMTP id g202mr11751wmg.74.1552335047677; Mon, 11 Mar 2019 13:10:47 -0700 (PDT) MIME-Version: 1.0 References: <20190310203403.27915-1-sultan@kerneltoast.com> <20190311174320.GC5721@dhcp22.suse.cz> <20190311175800.GA5522@sultan-box.localdomain> In-Reply-To: <20190311175800.GA5522@sultan-box.localdomain> From: Suren Baghdasaryan Date: Mon, 11 Mar 2019 13:10:36 -0700 Message-ID: Subject: Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android To: Sultan Alsawaf Cc: Michal Hocko , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Ingo Molnar , Peter Zijlstra , LKML , devel@driverdev.osuosl.org, linux-mm , Tim Murray Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sultan, On Mon, Mar 11, 2019 at 10:58 AM Sultan Alsawaf wrote: > > On Mon, Mar 11, 2019 at 06:43:20PM +0100, Michal Hocko wrote: > > I am sorry but we are not going to maintain two different OOM > > implementations in the kernel. From a quick look the implementation is > > quite a hack which is not really suitable for anything but a very > > specific usecase. E.g. reusing a freed page for a waiting allocation > > sounds like an interesting idea but it doesn't really work for many > > reasons. E.g. any NUMA affinity is broken, zone protection doesn't work > > either. Not to mention how the code hooks into the allocator hot paths. > > This is simply no no. > > > > Last but not least people have worked really hard to provide means (PSI) > > to do what you need in the userspace. > > Hi Michal, > > Thanks for the feedback. I had no doubt that this would be vehemently rejected > on the mailing list, but I wanted feedback/opinions on it and thus sent it as anRFC. Thanks for the proposal. I think Michal and Joel already answered why in-kernel LMK will not be accepted and that was one of the reasons the lowmemorykiller driver was removed in 4.12. > At best I thought perhaps the mechanisms I've employed might serve as > inspiration for LMKD improvements in Android, since this hacky OOM killer I've > devised does work quite well for the very specific usecase it is set out to > address. The NUMA affinity and zone protection bits are helpful insights too. The idea seems interesting although I need to think about this a bit more. Killing processes based on failed page allocation might backfire during transient spikes in memory usage. AFAIKT the biggest issue with using this approach in userspace is that it's not practically implementable without heavy in-kernel support. How to implement such interaction between kernel and userspace would be an interesting discussion which I would be happy to participate in. > I'll take a look at PSI which Joel mentioned as well. > > Thanks, > Sultan Alsawaf Thanks, Suren.