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=-13.2 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 8AD9EC433E0 for ; Wed, 23 Dec 2020 17:32:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0FDFB22227 for ; Wed, 23 Dec 2020 17:32:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FDFB22227 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 185B48D0038; Wed, 23 Dec 2020 12:32:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1374B8D0026; Wed, 23 Dec 2020 12:32:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F19508D0038; Wed, 23 Dec 2020 12:32:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id DC2C48D0026 for ; Wed, 23 Dec 2020 12:32:29 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 91FEE824999B for ; Wed, 23 Dec 2020 17:32:29 +0000 (UTC) X-FDA: 77625241218.27.map85_470252a2746a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 73AC53D668 for ; Wed, 23 Dec 2020 17:32:29 +0000 (UTC) X-HE-Tag: map85_470252a2746a X-Filterd-Recvd-Size: 5100 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Dec 2020 17:32:28 +0000 (UTC) Received: by mail-wr1-f52.google.com with SMTP id m5so19313935wrx.9 for ; Wed, 23 Dec 2020 09:32:28 -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=+u4HaQZ1cdgjeiGaZ8lzaVDKyHykee/RjOPEPv24mOI=; b=U4BfHPe+CwSjOhbhz0tlQtUuD4sLyUmYOyw3DR+Z8s9RwnSDQK8osHUb4PPSsCErx6 uM8gfuTZ3LMhL0IWTUFZMQ+SZFKDaNs8woYxEk0yxSM9azY3+UQcDNa5o2RBV/rtABcO v0L8TdXlWzc5hqcIsDiw5FbvECLAWsQyiToLpxguB7KkwGybzYgPleGhcB8y9+UPsCET v51Xv0W83LauUvH8J8Wg1xstijP4wylDk9BJKz/w+NKz27B84uNsG0Y40A8S/VhoOck/ 8XsKTwFgxBOCjrYrHTOi3BCgCaYB6GUQLrm0IBxnUo5cFSJw324NGTiqfdFpS5LpjUJB QIhA== 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=+u4HaQZ1cdgjeiGaZ8lzaVDKyHykee/RjOPEPv24mOI=; b=tmMxR5WpBg+hebOmrdMYCG/i9EVuNnUotKIT2CMXlbgno/zI12OlxYc7u2hHdssu9N rtdahtXb2iwZ2ndoTqzH4JbRyk0LFEqIa5KsP/T2ANAEIRkX//BkTueitlfBxwCjbEE2 zYfSh4uXwDXdjcyxgs5D4YqqipGjzHwWclNao96hcnoWuM9Ev9ex7bQst+g5T2krvs7m h+0lmmM5KwL+Nv/Q0XqqDGBCIY1atjZNjMxc17Mol6DDEKhNuggTNeT+xU+09e5L4X7j mV+shgN9MFXVGLpYN0hh9fkHKlqFe45Sj/Vhc5aBFENmybo19sjrYymg+X5EZ24jOfBf iyFQ== X-Gm-Message-State: AOAM532naDfv5ymHQk7jgFfqmjJ/r+dwDcG+AuKmZAgUIqovSs5egvMj jgIUSSuy1kKFV7uxLBQfh0J8YLgyHAbfTtPnkMcdiQ== X-Google-Smtp-Source: ABdhPJzUAsAuBD2dVSthDXzQ7IV73X0J7foD8oXS9oA18h84oUxm1ab4Ym5dVSyuFZBgVcIqjONvx6V9YQowI2xv8JE= X-Received: by 2002:adf:f0d0:: with SMTP id x16mr31048930wro.162.1608744747266; Wed, 23 Dec 2020 09:32:27 -0800 (PST) MIME-Version: 1.0 References: <20201124053943.1684874-1-surenb@google.com> <20201124053943.1684874-2-surenb@google.com> <20201125231322.GF1484898@google.com> <20201222134438.GA7170@infradead.org> <20201223075712.GA4719@lst.de> In-Reply-To: <20201223075712.GA4719@lst.de> From: Suren Baghdasaryan Date: Wed, 23 Dec 2020 09:32:16 -0800 Message-ID: Subject: Re: [PATCH 1/2] mm/madvise: allow process_madvise operations on entire memory range To: Christoph Hellwig Cc: Christoph Hellwig , Jann Horn , Minchan Kim , Andrew Morton , Michal Hocko , Michal Hocko , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Christian Brauner , Oleg Nesterov , Tim Murray , Linux API , Linux-MM , kernel list , kernel-team 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 Tue, Dec 22, 2020 at 11:57 PM Christoph Hellwig wrote: > > On Tue, Dec 22, 2020 at 09:48:43AM -0800, Suren Baghdasaryan wrote: > > Thanks for the feedback! The use case is userspace memory reaping > > similar to oom-reaper. Detailed justification is here: > > https://lore.kernel.org/linux-mm/20201124053943.1684874-1-surenb@google.com > > Given that this new variant of process_madvise > > a) does not work on an address range True, however I can see other madvise flavors that could be used on the entire process. For example process_madvise(MADV_PAGEOUT) could be used to "shrink" an entire inactive background process. > b) is destructive I agree that memory reaping might be the only case when a destructive process_madvise() makes sense. Unless the target process is dying, a destructive process_madvise() would need coordination with the target process, and if it's coordinated then the target might as well call normal madvise() itself. > c) doesn't share much code at all with the rest of process_madvise It actually does reuse a considerable part of the code, but the same code can be refactored and reused either way. > > Why not add a proper separate syscall? I think my answer to (a) is one justification for allowing process_madvise() to operate on the entire process. Also MADV_DONTNEED seems quite suitable for this operation. Considering the above answers, are you still leaning towards a separate syscall? > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >