From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 8ECCAC11F66 for ; Wed, 30 Jun 2021 18:26:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 33A2F61004 for ; Wed, 30 Jun 2021 18:26:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33A2F61004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7C1948D01BE; Wed, 30 Jun 2021 14:26:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 771BE8D01A2; Wed, 30 Jun 2021 14:26:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EBB58D01BE; Wed, 30 Jun 2021 14:26:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 363858D01A2 for ; Wed, 30 Jun 2021 14:26:33 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EE378231AE for ; Wed, 30 Jun 2021 18:26:32 +0000 (UTC) X-FDA: 78311220624.25.B09319B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf02.hostedemail.com (Postfix) with ESMTP id 97F437001BBC for ; Wed, 30 Jun 2021 18:26:32 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 98BA861469 for ; Wed, 30 Jun 2021 18:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625077591; bh=NiDKvaoHWhQWL7LZpA/F0WCrtvRRTYSJpDsh8l1Scc0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QDCDUmbgFSULOVxOXrFfEkiMtguCg7CaYaNWarqdebj6ngB5MDNNqjXNV1u0u5f6G fTaA30rQX1sUwWOw0++2tJRH3+SQRUgiIPRWJxBI5ae5UDPXWAYXkgvXRG4dJqbfqs JpGGC3wzMoUrB+/vQOiXA4nCnl+fyqv9QoYUCBRXUlM1IT+J+cjt+jJ/bzmlMIWG0J OsXs8xGBzEXX3ecsSJHya09bObnovQfqMdtw6QBhM80Jgw6aXvUh1kH0EeawftfBdI S5RCPnU1v/38EmeUBcvz/JUw5+t3PHlHy28fJnba0AP8bKlo/7ou5wFC9RnkXTpHzW Sninjvx+DvNZg== Received: by mail-ej1-f50.google.com with SMTP id i20so5481755ejw.4 for ; Wed, 30 Jun 2021 11:26:31 -0700 (PDT) X-Gm-Message-State: AOAM533lQVn+ZMlqg/v6N3O4IOIXO/utQhJ9VoXXh8+pYN1vZ/5A/zS2 HuTDCmDdZlmgyMlK/Z6XuNf2yag9pOYIedPAyNTOZA== X-Google-Smtp-Source: ABdhPJyVpRp+MrbZ/NDxiBqc8BHandsXdJxtq3YXXo39g1rzU6iO0EtDXnr7P9D+TuDyBcYLS2TxQiVvxc1oSGA9+nU= X-Received: by 2002:a17:906:cb81:: with SMTP id mf1mr37639978ejb.199.1625077589941; Wed, 30 Jun 2021 11:26:29 -0700 (PDT) MIME-Version: 1.0 References: <20210623192822.3072029-1-surenb@google.com> In-Reply-To: <20210623192822.3072029-1-surenb@google.com> From: Andy Lutomirski Date: Wed, 30 Jun 2021 11:26:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/1] mm: introduce process_reap system call To: Suren Baghdasaryan Cc: Andrew Morton , Michal Hocko , Michal Hocko , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Shakeel Butt , Tim Murray , Linux API , Linux-MM , LKML , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QDCDUmbg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of luto@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=luto@kernel.org X-Stat-Signature: szu7xyza5hsgu8ncak53ame76rteqff4 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 97F437001BBC X-HE-Tag: 1625077592-267969 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 Wed, Jun 23, 2021 at 12:28 PM Suren Baghdasaryan wrote: > > In modern systems it's not unusual to have a system component monitoring > memory conditions of the system and tasked with keeping system memory > pressure under control. One way to accomplish that is to kill > non-essential processes to free up memory for more important ones. > Examples of this are Facebook's OOM killer daemon called oomd and > Android's low memory killer daemon called lmkd. > For such system component it's important to be able to free memory > quickly and efficiently. Unfortunately the time process takes to free > up its memory after receiving a SIGKILL might vary based on the state > of the process (uninterruptible sleep), size and OPP level of the core > the process is running. A mechanism to free resources of the target > process in a more predictable way would improve system's ability to > control its memory pressure. > Introduce process_reap system call that reclaims memory of a dying process > from the context of the caller. This way the memory in freed in a more > controllable way with CPU affinity and priority of the caller. The workload > of freeing the memory will also be charged to the caller. > The operation is allowed only on a dying process. At the risk of asking a potentially silly question, should this just be a file in procfs? Also, please consider removing all mention of the word "reap" from the user API. For better or for worse, "reap" in UNIX refers to what happens when a dead task gets wait()ed. I sincerely wish I could go back in time and gently encourage whomever invented that particular abomination to change their mind, but my time machine doesn't work. --Andy