Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp55581pxy; Wed, 21 Apr 2021 18:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDRZ4axmQAthHstWQ15hox514EgIEFagLfvM4BfZsxSeEW4SpQYmyny/PhAuJDNNib3++S X-Received: by 2002:a17:902:e34b:b029:ec:9a57:9cba with SMTP id p11-20020a170902e34bb02900ec9a579cbamr911906plc.56.1619054444105; Wed, 21 Apr 2021 18:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619054444; cv=none; d=google.com; s=arc-20160816; b=qL9YtkLKPydWcGe+dLRulMQHLF4Wpn0euS2KSDf9oYJ33lnmI73yM7ieWLrBsbzJki OMvtMHKu0/Ap7caw+dwRdsvvF/CzkXnSrgXA1EQw5Y2iAiuLqFGIM+zzKQ2uo9RiI0P9 7C537ZUe7iomG74QlaL0uv7fQdbXTl0T0THHyZf2rKViNPnlMUYUN9I1v/UQ4E1shTja I3nM5zou1GdnbcXr225RzQe3Cry64oY7QYI/15vyTKntrHXSw/Pcdfyhba27Pr1MSK/4 CFT+Y8xH4toKa6970ZWpWqz+o0GiTZoAXJL1BUJLIMzHGC2FYomAGGCZt8qDWQtS8EeM 1j3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=50kzeCPGjm2JMXyK7PkTEiD0mm3C2OtO1PpsOLUYSss=; b=So4B+x7UZAsr/T2wTGSs/5fLPdSvySZftH3nHDeoPNRfHYiZzp7wJdNeF9ivMx/2Rd 7gfKjNjx9GMp68ItVzku9PyrCDf7vx6mP/5T/YXKx0WIpwD2CHGecvRrdR1WlC3JJgZn HDPjB4pjaaUGLSkjHtIn7IgZemlTOW37ZHWOHpC9CX2ejTHl7ECDbPptjxbIqSrxGlK4 gYmFSEjDjEYoPH5GdgwBWdseuAg41Si5q3b1d3O6CcxD3MbbnpooPDLyVJO4DLVEk8gh ZY368P6nQZteqObjtAEbOPy+ydjUgWVemWh7SvwXeKll2xkB+gMZltUrXn22vqxd4etW yK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T5uVrfbF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g24si1318796pgj.554.2021.04.21.18.20.32; Wed, 21 Apr 2021 18:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=T5uVrfbF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242672AbhDUTTL (ORCPT + 99 others); Wed, 21 Apr 2021 15:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243035AbhDUTTJ (ORCPT ); Wed, 21 Apr 2021 15:19:09 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FE9CC06174A for ; Wed, 21 Apr 2021 12:18:35 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id x19so38059168lfa.2 for ; Wed, 21 Apr 2021 12:18:35 -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=50kzeCPGjm2JMXyK7PkTEiD0mm3C2OtO1PpsOLUYSss=; b=T5uVrfbF8qU1G524RKlJRFgst7C0N8b4H2i02+jwmhpvtNGQJmtRwATMQyisjPGKwT gsYjxwjD/BmmQlIvAf37RXRIKswGX+Hv5IHJWeJIGmVhisndacaJ5qoPcN/oMkAWKI2K rXoWb3LP/jKJJcJoTQxXEwTnmALDSCLAr8aF4kENjxcOQsR1FiyM3YpiQEEA+/MirhaW +P/0OecI6/mj//o2QV4f3/hm4ceifXZNLLqS/ltvN0Gkvy/DDlCZBBrWKzInmGXh+DJB lq2C30XJHf5e6QSu2w8xVzy48r71MroUUoeyLBA+TWWQtRq16jzncXwVIx0S3LBgkBnU pXTA== 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=50kzeCPGjm2JMXyK7PkTEiD0mm3C2OtO1PpsOLUYSss=; b=coNGE2iTwOUJ5dR64QQiCte4ifJOI0VvIFO4mtIXL0L8XuU+X7pWSdaUSKOOT8hCGd VAOodWeLcZoIvGjKlRJYKC36a23ilxUhSng9YUKjjSmg3AVAQAXh2BtAkLYMnFKIrvSO EbrRKr2w8hTmtxjQQDtXzeENhnejPvqu/uoCGYki34ETz+vLqTUKB5X7aYnNxJWFx4dq WG5dwahfLxXaWZlOrgmvwx/WZe/cCmEPRm8V+e8i6IWgoOuKaQgPQGPEaP5490ps9o/W yQ5IcSolCwGz0IEpJIxeHXlhq6ObFKHYynqkyvI1IzCGo/6FoPfz38jF4JXRnkiOS4zo w9vA== X-Gm-Message-State: AOAM531Yd2NTmPq4aVTMEPfIHDiO5gn3fFpLXOEE+actzs1RRpQ1e6eB hpnZpdkZ3CFvF/d2Kp5p3jFiLtkEnx+2+9oa+Aasrg== X-Received: by 2002:a05:6512:92e:: with SMTP id f14mr14648390lft.347.1619032713794; Wed, 21 Apr 2021 12:18:33 -0700 (PDT) MIME-Version: 1.0 References: <699e51ba-825d-b243-8205-4d8cff478a66@sony.com> <1f8d300b-9a8b-de09-6d5d-6a9c20c66d24@sony.com> In-Reply-To: <1f8d300b-9a8b-de09-6d5d-6a9c20c66d24@sony.com> From: Shakeel Butt Date: Wed, 21 Apr 2021 12:18:22 -0700 Message-ID: Subject: Re: [RFC] memory reserve for userspace oom-killer To: peter enderborg Cc: Johannes Weiner , Roman Gushchin , Michal Hocko , Linux MM , Andrew Morton , Cgroups , David Rientjes , LKML , Suren Baghdasaryan , Greg Thelen , Dragos Sbirlea , Priya Duraisamy Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 21, 2021 at 11:46 AM wrote: > > On 4/21/21 8:28 PM, Shakeel Butt wrote: > > On Wed, Apr 21, 2021 at 10:06 AM peter enderborg > > wrote: > >> On 4/20/21 3:44 AM, Shakeel Butt wrote: > > [...] > >> I think this is the wrong way to go. > > Which one? Are you talking about the kernel one? We already talked out > > of that. To decide to OOM, we need to look at a very diverse set of > > metrics and it seems like that would be very hard to do flexibly > > inside the kernel. > You dont need to decide to oom, but when oom occurs you > can take a proper action. No, we want the flexibility to decide when to oom-kill. Kernel is very conservative in triggering the oom-kill. > > [...] > > Actually no. It is missing the flexibility to monitor metrics which a > > user care and based on which they decide to trigger oom-kill. Not sure > > how will watchdog replace psi/vmpressure? Userspace keeps petting the > > watchdog does not mean that system is not suffering. > > The userspace should very much do what it do. But when it > does not do what it should do, including kick the WD. Then > the kernel kicks in and kill a pre defined process or as many > as needed until the monitoring can start to kick and have the > control. > Roman already suggested something similar (i.e. oom-killer core and extended and core watching extended) but completely in userspace. I don't see why we would want to do that in the kernel instead. > > > > In addition oom priorities change dynamically and changing it in your > > system seems very hard. Cgroup awareness is missing too. > > Why is that hard? Moving a object in a rb-tree is as good it get. > It is a group of objects. Anyways that is implementation detail. The message I got from this exchange is that we can have a watchdog (userspace or kernel) to further improve the reliability of userspace oom-killers.