Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5960801pxu; Wed, 23 Dec 2020 09:34:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJy93dqxC1G6gg5v9xGQ4+eWj3wuc7Jo0rYRpoXLd+sAB2pEgdUjHe0DWj1IHuPx8GRxZT74 X-Received: by 2002:a50:875b:: with SMTP id 27mr26152790edv.24.1608744841296; Wed, 23 Dec 2020 09:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608744841; cv=none; d=google.com; s=arc-20160816; b=IPbRp47Hd/obes9zMHNkq9+ZPmqeB7DKoURrgw8VchfDoeg7IYVPm10MmEToLweJBy r3BjVh+19AVVn9iDdHlx43cr9uJA957lHZOuCD/iq0JtTDLBCQo1f04Ih97/8iDuDJ8f 9/by+MnCWPDgjZD1kRRwZGXWCjmewEft+0oW8yyz6aVDtUz/PC7Z/OIK0LAxuA18qR7e BjjfXFcarv8Ms40G9wHGndP4uLxdZnU+dmvnim+PehFewbgzV1sMdaeWHTvwrlf/56g/ PoXOUeaV9+bgJJ3WBkX300XifC0jLXyFYBTIZ4vXMXYC1TYLDx02NeECntTV1MQ5+rMc E6Hg== 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=+u4HaQZ1cdgjeiGaZ8lzaVDKyHykee/RjOPEPv24mOI=; b=M5bWK3CsrYuxCuDl7+4RqmqgkCMzcKNRBAll9LgkuP75jgew7Tn9zXepX9fRvsoWw0 9H7wKYd5rlxwWZGCJRE1Mf/mxxVGNIhPPh4JqOyshbMYP8Bzd5iGlRcCdNkVdl1I/tya nbM68LzTF4Yo86yIj1shztSAI0+9uHtdq20RDXInM6r6Ng3Zlg+DaweojCt/wBoQuKkL cmXRMUcRm5F+RhKOV2+ZTL1QGP0f1Hlu8c+SkVOLQJtSD4pWWaSrHPdeK8xa+/qbFNhi WpHQsOP5MZVcdASKf/Mmi7LWt3nLA7Ew6RcUy4eg07KLgbdarKIJ/QlmAH7iRG3n+zw1 PzBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=U4BfHPe+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga25si12386958ejb.636.2020.12.23.09.33.37; Wed, 23 Dec 2020 09:34:01 -0800 (PST) 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=@google.com header.s=20161025 header.b=U4BfHPe+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgLWRdJ (ORCPT + 99 others); Wed, 23 Dec 2020 12:33:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgLWRdJ (ORCPT ); Wed, 23 Dec 2020 12:33:09 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D50A9C0617A6 for ; Wed, 23 Dec 2020 09:32:28 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id y17so19334625wrr.10 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=uiwegskCuufP2b7PQ5NeZX8xPuHFyec75zsJTommqQnWVQMqRlL+bO24b8ggym3miI nKfqAwkI0CY1R1y7R7+DY2wwOYB4xUfi+yvrHnro9VkkV73Bpge1pK1yh2E1PugmyUT/ RPDQE0DCB5WKLQyvibq1Mdz7aZVLDwKMa20TeXYl/HsAXxLGROtIs23n4a2RUCDpyVlJ l0Sf/oo5zjAIF/jMkOwb2PiQAN8WCBr6n3oZJeDqFUXlmuPzdN52Y9DwCr+VLIPCrOa4 epSlExWCy2kDmVH5jbvv35VBZM5ZdeI4xDPKpAt+jj0cmHTAroEQ3mdxoFmBnrabGPt7 D2Yg== X-Gm-Message-State: AOAM530IDddgtSHscYfH9ciH3cMNhi3utnFpwneMamNBYUjLT6QwG3P/ ijrHjCyC6kOhdUyz/c8tapE0W3Fixc2NZwXmYJ+GeQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >