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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 181AFC63697 for ; Sat, 14 Nov 2020 01:57:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 791B322256 for ; Sat, 14 Nov 2020 01:57:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ed7NqWQn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 791B322256 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BF79D6B005C; Fri, 13 Nov 2020 20:57:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA8776B005D; Fri, 13 Nov 2020 20:57:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A97846B0068; Fri, 13 Nov 2020 20:57:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 7D1D56B005C for ; Fri, 13 Nov 2020 20:57:15 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 25DF51EE6 for ; Sat, 14 Nov 2020 01:57:15 +0000 (UTC) X-FDA: 77481361230.12.coal18_391806827313 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id EFCDE18005B0E for ; Sat, 14 Nov 2020 01:57:14 +0000 (UTC) X-HE-Tag: coal18_391806827313 X-Filterd-Recvd-Size: 6329 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sat, 14 Nov 2020 01:57:14 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id 33so12264602wrl.7 for ; Fri, 13 Nov 2020 17:57:14 -0800 (PST) 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=aAt0y4BONkE4qAf0vKXaFTXwB4ZFsnt5S+RuI0jP7I0=; b=ed7NqWQne82b4CGLxKKyy40f2AtEDak0uE2vEFG0Eg45fsFvqzucto15OoBmGMcffH eCmMx6p4CbPjbJNtXw4hA1XqGxNSWvKhZ3MUkh8mXF6oVpyK1k3jReyT19EPA2ytP5lx U5vvLq2u3KQZv0N4RU+9z0WSEEC8D0xmgmG8ltLYw2xPp/JAD/0V80adsjygNw7S6v8H uU9/TJsJohTb7QVz8fw8jXdBnk5xbNFrjX+6+64MjkDWrL6ibdOFH08eUnlaPTROXsTy ZRARIgSzlfxFT1+3g5kSqOD/eJPung8kpqou4ldSK3ZSY0e40DJiyXH9M7op5k8DWPJG +1GA== 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=aAt0y4BONkE4qAf0vKXaFTXwB4ZFsnt5S+RuI0jP7I0=; b=MIS97MU8+GKY9+WxEi6DNi16495uZcTxrDyb6FEHsUCI9DwNpCzdwo6u/DEf1IrxDz s4bwSiNhbLz0vCXmxAW4aI0Adh3afIuiOVCv6MGo7NiFOep587canj/Uw9a8Q383aJ1a UP8DvBGEXTVfQHtO1eJF8KtNCCKYaJuF9viEpCwKlQwdGrevFTohl+WlL26zacpHD1d2 PJe2P6uj9RtRY/+168c3j7n4Hdbb8+2PtAjAaaLRh1G3xtElul5EyPGT5CGj7be2YdMD L+RigqvStcOAow/8GNDvo9ruf1j5TwCecG7nIwKYmOQm0Z/z7l3VQXq24vDYu7eFCebd 0KPg== X-Gm-Message-State: AOAM532odgPmPUVJKopdLxMTse8VnM60bmUDFNpLRK7nOX5MyA8EyoF+ TpJyzTAPQYTNLjxVXfV7vbHKr/1IDiqiqke4l4JDpQ== X-Google-Smtp-Source: ABdhPJwjEBEJE7QwHh8r8eJ/Dr/QpuyVP5uaIDwltg3aDAOCe0B4f3/m8hgpvfE9jUit9zlrGz89Vmb3ppScDtAYkS0= X-Received: by 2002:adf:cf0b:: with SMTP id o11mr6715761wrj.162.1605319033090; Fri, 13 Nov 2020 17:57:13 -0800 (PST) MIME-Version: 1.0 References: <20201113173448.1863419-1-surenb@google.com> <20201113155539.64e0af5b60ad3145b018ab0d@linux-foundation.org> <20201113170032.7aa56ea273c900f97e6ccbdc@linux-foundation.org> <20201113171810.bebf66608b145cced85bf54c@linux-foundation.org> In-Reply-To: <20201113171810.bebf66608b145cced85bf54c@linux-foundation.org> From: Suren Baghdasaryan Date: Fri, 13 Nov 2020 17:57:02 -0800 Message-ID: Subject: Re: [PATCH 1/1] RFC: add pidfd_send_signal flag to reclaim mm while killing a process To: Andrew Morton Cc: Michal Hocko , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Christian Brauner , Oleg Nesterov , Tim Murray , linux-api@vger.kernel.org, linux-mm , LKML , kernel-team , Minchan Kim Content-Type: text/plain; charset="UTF-8" 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, Nov 13, 2020 at 5:18 PM Andrew Morton wrote: > > On Fri, 13 Nov 2020 17:09:37 -0800 Suren Baghdasaryan wrote: > > > > > > 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? > > > > > > > > Thank you for the feedback, Andrew. process_madvise(MADV_DONTNEED) was > > > > one of the options recently discussed in > > > > https://lore.kernel.org/linux-api/CAJuCfpGz1kPM3G1gZH+09Z7aoWKg05QSAMMisJ7H5MdmRrRhNQ@mail.gmail.com > > > > . The thread describes some of the issues with that approach but if we > > > > limit it to processes with pending SIGKILL only then I think that > > > > would be doable. > > > > > > Why would it be necessary to read /proc/pid/maps? I'd have thought > > > that a starting effort would be > > > > > > madvise((void *)0, (void *)-1, MADV_PAGEOUT) > > > > > > (after translation into process_madvise() speak). Which is equivalent > > > to the proposed process_madvise(MADV_DONTNEED_MM)? > > > > Yep, this is very similar to option #3 in > > https://lore.kernel.org/linux-api/CAJuCfpGz1kPM3G1gZH+09Z7aoWKg05QSAMMisJ7H5MdmRrRhNQ@mail.gmail.com > > and I actually have a tested prototype for that. > > Why is the `vector=NULL' needed? Can't `vector' point at a single iovec > which spans the whole address range? That would be the option #4 from the same discussion and the issues noted there are "process_madvise return value can't handle such a large number of bytes and there is MAX_RW_COUNT limit on max number of bytes one process_madvise call can handle". In my prototype I have a special handling for such "bulk operation" to work around the MAX_RW_COUNT limitation. > > > If that's the > > preferred method then I can post it quite quickly. > > I assume you've tested that prototype. How did its usefulness compare > with this SIGKILL-based approach? Just to make sure I understand correctly your question, you are asking about performance comparison of: // approach in this RFC pidfd_send_signal(SIGKILL, SYNC_REAP_MM) vs // option #4 in the previous RFC kill(SIGKILL); process_madvise(vector=NULL, MADV_DONTNEED); If so, I have results for the current RFC approach but the previous approach was testing on an older device, so don't have apples-to-apples comparison results at the moment. I can collect the data for fair comparison if desired, however I don't expect a noticeable performance difference since they both do pretty much the same thing (even on different devices my results are quite close). I think it's more a question of which API would be more appropriate. >