Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E5CC433ED for ; Wed, 5 May 2021 02:43:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C0F33613C4 for ; Wed, 5 May 2021 02:43:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0F33613C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 00E526B0111; Tue, 4 May 2021 22:43:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F00956B0112; Tue, 4 May 2021 22:43:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB3B16B0113; Tue, 4 May 2021 22:43:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id C03216B0111 for ; Tue, 4 May 2021 22:43:42 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 75F3D181AEF3C for ; Wed, 5 May 2021 02:43:42 +0000 (UTC) X-FDA: 78105631884.38.04BA2FF Received: from r3-19.sinamail.sina.com.cn (r3-19.sinamail.sina.com.cn [202.108.3.19]) by imf19.hostedemail.com (Postfix) with SMTP id E17D090009EF for ; Wed, 5 May 2021 02:43:08 +0000 (UTC) Received: from unknown (HELO localhost.localdomain)([124.64.16.31]) by sina.com (172.16.97.35) with ESMTP id 609206560001A77E; Wed, 5 May 2021 10:43:37 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 14210115073463 From: Hillf Danton To: Shakeel Butt Cc: Michal Hocko , Johannes Weiner , Roman Gushchin , Linux MM , Andrew Morton , Cgroups , David Rientjes , LKML , Suren Baghdasaryan , Greg Thelen , Dragos Sbirlea , Priya Duraisamy Subject: Re: [RFC] memory reserve for userspace oom-killer Date: Wed, 5 May 2021 10:43:24 +0800 Message-Id: <20210505024324.11292-1-hdanton@sina.com> In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of hdanton@sina.com designates 202.108.3.19 as permitted sender) smtp.mailfrom=hdanton@sina.com; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E17D090009EF X-Stat-Signature: kdd3estzg6x1536xaix8txaaguq1tcum Received-SPF: none (sina.com>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=r3-19.sinamail.sina.com.cn; client-ip=202.108.3.19 X-HE-DKIM-Result: none/none X-HE-Tag: 1620182588-685417 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 4 May 2021 17:37:32 Shakeel Butt wrote: >On Wed, Apr 21, 2021 at 7:29 AM Michal Hocko wrote: >[...] >> > > What if the pool is depleted? >> > >> > This would mean that either the estimate of mempool size is bad or >> > oom-killer is buggy and leaking memory. >> > >> > I am open to any design directions for mempool or some other way whe= re >> > we can provide a notion of memory guarantee to oom-killer. >> >> OK, thanks for clarification. There will certainly be hard problems to >> sort out[1] but the overall idea makes sense to me and it sounds like = a >> much better approach than a OOM specific solution. >> >> >> [1] - how the pool is going to be replenished without hitting all >> potential reclaim problems (thus dependencies on other all tasks >> directly/indirectly) yet to not rely on any background workers to do >> that on the task behalf without a proper accounting etc... >> -- > >I am currently contemplating between two paths here: > >First, the mempool, exposed through either prctl or a new syscall. >Users would need to trace their userspace oom-killer (or whatever >their use case is) to find an appropriate mempool size they would need >and periodically refill the mempools if allowed by the state of the >machine. The challenge here is to find a good value for the mempool >size and coordinating the refilling of mempools. > >Second is a mix of Roman and Peter's suggestions but much more >simplified. A very simple watchdog with a kill-list of processes and >if userspace didn't pet the watchdog within a specified time, it will >kill all the processes in the kill-list. The challenge here is to >maintain/update the kill-list. > >I would prefer the direction which oomd and lmkd are open to adopt. > >Any suggestions? > The kill list is drained once the wd starts doing its job AFAICT, would you likely specify a bit on what matters if a process goes home before waking up the wd? What will happen if it would signal the pid of a non-existing one with the consequences all ignored? Other than that, what is in your mind over the challenge to maintain the kill-list? Hillf