Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp544143pxv; Wed, 30 Jun 2021 11:27:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEAicm1lf4+ZYybb8gT/ZtBmhDyfp8JYzw4AIMPRtg7PqC6hZrb2Untg+ip8ozQkSflve6 X-Received: by 2002:a17:906:2590:: with SMTP id m16mr18667731ejb.265.1625077676837; Wed, 30 Jun 2021 11:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625077676; cv=none; d=google.com; s=arc-20160816; b=S7JiqZcfKN6uvl4wMGN96PKrKf2K5gYVYub8SBN+uovgSjZBKDc8gVL7w0qpRpNS3M SgAiZenTgDAQEVREdoP41kl4InKmVjbtW9ho870Vre+1WoJT8M2wdED/2NEo2IM+WyBi KG3Fbpw0KxLe4TSok4QsBZ1HbrEisAHUhaIW200HZZwfLkPk1+xB8CSzM/eXtQwXeg8c hvcqCLa7oJmufqvIXOG6HG4eC0NiPoJZnVcKjlrllDlKYxlcnHAbRBsdEEqYWitwgvz7 WulccYQF7MMIm6j6PN7aCtXFepG2F+GbqBVxMa89BbjZ57oYvaT3mG1yw4O+YLTja+Q6 I04w== 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=kju/HexFSeinf6vXhokneI1oOeGfxuV4HRrIWz1ek6I=; b=joBekHiCxt4ZLfTIsxjn7cpXzlsetT0NKapRwF4DuKvmwpD6gx7SY7h6PC04kQXWVX VvqCe7B6bYE4cgk49qOt/7hhEhtOC5dCP5sdJ3GQVK0tJpDRmUKuiMQDGB+VTahTWDOj dM7E1xhKJCT74JTY8nVh/wPZvNyAYLEgcmKS1BkKIYvRD9fPJqYDRbPLFBpfhE5zB1gE 0tLbrrh+3bpvzfgkpbzFugY9MdzmA57pzKivQ4F8tytyDwjqPDzR1MsxaZ3jrNFA07YD /4swFCj/n3uoC1Yzp60OBQxtnpN7DJi1YkLac9AauwGMLc3zeymt5qdZUuynw9p0o1KV k45g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QDCDUmbg; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx28si21649411ejc.43.2021.06.30.11.27.30; Wed, 30 Jun 2021 11:27:56 -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=@kernel.org header.s=k20201202 header.b=QDCDUmbg; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233076AbhF3S3B (ORCPT + 99 others); Wed, 30 Jun 2021 14:29:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbhF3S3A (ORCPT ); Wed, 30 Jun 2021 14:29:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74543613B0 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-f45.google.com with SMTP id yy20so5831306ejb.6 for ; Wed, 30 Jun 2021 11:26:31 -0700 (PDT) X-Gm-Message-State: AOAM531SagV2Eu4xqTOiJy7GwRZq1+cCjoxGmGSxoj4/GcwFPaZtIkZy iAmo0r2TEIhqNdcVNQ1kFaCsaXvxFYD0fhaBvOPXhA== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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