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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 85CDBC4742C for ; Fri, 13 Nov 2020 23:55:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D87D0214D8 for ; Fri, 13 Nov 2020 23:55:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="VNoww2mH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D87D0214D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 183276B005C; Fri, 13 Nov 2020 18:55:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 135B26B005D; Fri, 13 Nov 2020 18:55:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04B726B0068; Fri, 13 Nov 2020 18:55:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id CEAC26B005C for ; Fri, 13 Nov 2020 18:55:42 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 754811EE6 for ; Fri, 13 Nov 2020 23:55:42 +0000 (UTC) X-FDA: 77481054924.16.room48_4a0e96727313 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 5440B100E6917 for ; Fri, 13 Nov 2020 23:55:42 +0000 (UTC) X-HE-Tag: room48_4a0e96727313 X-Filterd-Recvd-Size: 3041 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Nov 2020 23:55:41 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23A1120B80; Fri, 13 Nov 2020 23:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605311740; bh=Mh4yXLMcmZQt7AZnvC9pTq+YtBQJCLQlTJ6Hv2pRFNs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VNoww2mH/7yh/oHYpz+Udrp4ex+Q74+w8jiJQDU4dVn3K2hg5gYJvbS2kOaYF/23C +PYWS6Yn2GH5pNQtu9u+G9TEXK2lGPqwp/vfmqN+k3AHGcdk+rPr+opX+YznNF8/bF OUjZ3RbCIj/XgQO43GcSiEYmIcvDL26r36p64Bas= Date: Fri, 13 Nov 2020 15:55:39 -0800 From: Andrew Morton To: Suren Baghdasaryan Cc: mhocko@kernel.org, rientjes@google.com, willy@infradead.org, hannes@cmpxchg.org, guro@fb.com, riel@surriel.com, minchan@kernel.org, christian@brauner.io, oleg@redhat.com, timmurray@google.com, linux-api@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Minchan Kim Subject: Re: [PATCH 1/1] RFC: add pidfd_send_signal flag to reclaim mm while killing a process Message-Id: <20201113155539.64e0af5b60ad3145b018ab0d@linux-foundation.org> In-Reply-To: <20201113173448.1863419-1-surenb@google.com> References: <20201113173448.1863419-1-surenb@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 13 Nov 2020 09:34:48 -0800 Suren Baghdasaryan wrote: > When a process is being killed it might be in an uninterruptible sleep > which leads to an unpredictable delay in its memory reclaim. In low memory > situations, when it's important to free up memory quickly, such delay is > problematic. Kernel solves this problem with oom-reaper thread which > performs memory reclaim even when the victim process is not runnable. > Userspace currently lacks such mechanisms and the need and potential > solutions were discussed before (see links below). > This patch provides a mechanism to perform memory reclaim in the context > of the process that sends SIGKILL signal. New SYNC_REAP_MM flag for > pidfd_send_signal syscall can be used only when sending SIGKILL signal > and will lead to the caller synchronously reclaiming the memory that > belongs to the victim and can be easily reclaimed. hm. Seems to me that the ability to reap another process's memory is a generally useful one, and that it should not be tied to delivering a signal in this fashion. And we do have the new process_madvise(MADV_PAGEOUT). It may need a few changes and tweaks, but can't that be used to solve this problem?