Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp633094ybh; Thu, 12 Mar 2020 08:18:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvrtUIZvHIu0IVmrNFceXWgTu43Udp462hf2of0LzHo/FU8LWTI8/Y82qbTrNBK5pJaQPqV X-Received: by 2002:a9d:20e2:: with SMTP id x89mr6253681ota.252.1584026305767; Thu, 12 Mar 2020 08:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584026305; cv=none; d=google.com; s=arc-20160816; b=wYZildu7a9PKCx+0YWYEDzG9PzL8fCXgT0eRGk7BjEAFIOCLs0yDI/2GgeEfzI4mTt BT7WnfEFL/U7vWlcChApQggzhVnGSDoh/yqUNFrw+38mglTCEvDBIAOX+GEds/PfHi6W bpjgAOE2n9ULQa8zRWYNKyx+qZva0vNSfiucajrieP3JhlhlANvqdZcd1OSIB9O+WoT7 or6+7mBTX5UK2obwAt5vJXIHs1r9Ok5psKvnefcgQxLoZnNRy88sl9mvBjy62d3wg/Oz xaT8J5DxISudepJDJQIqit3hAnaVGLkePCuTro/4O5etn8wg+U3qcVGvtQfLEmltWdhk ptQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NSTFM8/WdvLF0ae3U5Pe/dfIhwqQ/fRGMD5U9ltFSU0=; b=1CNw/KocVSkIp8eOrnv0TXjPLKjpe/3hfKJBoLZ6ODOshu5vLI0TO92nUjXzO6U6Vc EAM/ZeipW4lCOsamOQXabM3jJTy7uiQBsSfBPcL+7uwyjSLj8rsP33mst3rYaH+TTILj FFY6eUUgWjG9rrrfqocQzNzp38sZ5pVgDoPcESLbkDFR88MfFYw7+tWOx8SGfxW4SrIU kGG1BqUS5U5wlniGBEDvEm3T3vPswvm9hcDnh0cB7LnhiuzTyHxnqOl2nOY1vRL96/+R 2g8pjzKT9DAV500Bo43S0GS/EhDcjU5rWqBGWXUfhJpx//GSQAIIxap4ORVnCoi1tBgp f0uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qCTFDwlu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v137si2628325oif.170.2020.03.12.08.18.12; Thu, 12 Mar 2020 08:18:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qCTFDwlu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727767AbgCLPPz (ORCPT + 99 others); Thu, 12 Mar 2020 11:15:55 -0400 Received: from mail-oi1-f180.google.com ([209.85.167.180]:45405 "EHLO mail-oi1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727455AbgCLPPz (ORCPT ); Thu, 12 Mar 2020 11:15:55 -0400 Received: by mail-oi1-f180.google.com with SMTP id v19so5794664oic.12 for ; Thu, 12 Mar 2020 08:15:54 -0700 (PDT) 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=NSTFM8/WdvLF0ae3U5Pe/dfIhwqQ/fRGMD5U9ltFSU0=; b=qCTFDwluq+BMNWVlMj7j9pxcr8xJNHb/X3tPT6I/w+ZcHawky11wfNujEo51HzirkP AldXdYOGclnzlpfbSaL4BxbMgyWnOFy/Z+2TAzFteCz2//DJyDZhzBCjmRji13aIzRHi PW9IXXtafsjLnpwGdtnsxrA7UfSqvyKX/uwrgxh85dRh/yhj7iVwXWTe7SliAsjrRuhk 8iUH0KPD/+MWIJ/42dn8jWer/B0rcVgDSp/N5gLydkrUpXX+SMahFDj53hCiy4AXYdt/ 2LMrJ5nDI5B3G1WS9taS27TPOtna6Bjbe6RAS9dLKrygImRFFdt4l7GQ8dfuiFTmlgCv 4hOg== 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=NSTFM8/WdvLF0ae3U5Pe/dfIhwqQ/fRGMD5U9ltFSU0=; b=FuNId3ubnMux3Rk8pXRcZ9d3LBEiQjnaE1L/d7ReZghKKiJLkvIVxtvIJHNe/F1ch6 rl8iQ1RyK3A+RDfKF4cnDKxokaBAIQoXBni4TWBVBpRfmCppp60Kz4AjF2pfVSJg6eQ8 81Wnmi7fllc+P7UYPGxsfECFCM+WX5qElTZlOWN0+uJT8VP/FkFd+S0Lan7MNtldpGNc FeevKURiGDAJkuJDvN6GN2ZKijT2VbUEMmvukE+qB3id//i+WYyBetPflsXcOAIvaJff P5WYtiCmzWVn4x5Zf8y40YiKegKFR3+J+rwBB6ad1Gjviq4jcQn9Ugm7CL2okY/iq6wO BjLg== X-Gm-Message-State: ANhLgQ1pQ2tMVsaSF/3JDyGGB/uiqzt2yiYS3nM7a2rQubR6OcU7lbkF BEXOJmnbTtZMi094ByNAZ4k5pseDGhxga1WGlEJfIw== X-Received: by 2002:aca:af93:: with SMTP id y141mr2863661oie.144.1584026154099; Thu, 12 Mar 2020 08:15:54 -0700 (PDT) MIME-Version: 1.0 References: <20200310184814.GA8447@dhcp22.suse.cz> <20200310210906.GD8447@dhcp22.suse.cz> <20200311084513.GD23944@dhcp22.suse.cz> <20200312001849.GA96953@google.com> In-Reply-To: From: Shakeel Butt Date: Thu, 12 Mar 2020 08:15:42 -0700 Message-ID: Subject: Re: interaction of MADV_PAGEOUT with CoW anonymous mappings? To: Daniel Colascione Cc: Minchan Kim , Michal Hocko , Dave Hansen , Jann Horn , Linux-MM , kernel list , "Joel Fernandes (Google)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 11, 2020 at 7:04 PM Daniel Colascione wrote: > > On Wed, Mar 11, 2020 at 5:18 PM Minchan Kim wrote: > > > > On Wed, Mar 11, 2020 at 04:53:17PM -0700, Shakeel Butt wrote: > > > On Wed, Mar 11, 2020 at 1:45 AM Michal Hocko wrote: > > > > > > > > On Tue 10-03-20 15:48:31, Dave Hansen wrote: > > > > > Maybe instead of just punting on MADV_PAGEOUT for map_count>1 we should > > > > > only let it affect the *local* process. We could still put the page in > > > > > the swap cache, we just wouldn't go do the rmap walk. > > > > > > > > Is it really worth medling with the reclaim code and special case > > > > MADV_PAGEOUT there? I mean it is quite reasonable to have an initial > > > > implementation that doesn't really touch shared pages because that can > > > > lead to all sorts of hard to debug and unexpected problems. So I would > > > > much rather go with a simple patch to check map count first and see > > > > whether somebody actually cares about those shared pages and go from > > > > there. > > > > > > > > Minchan, do you want to take my diff and turn it into the proper patch > > > > or should I do it. > > > > > > > > > > What about the remote_madvise(MADV_PAGEOUT)? Will your patch disable > > > the pageout from that code path as well for pages with mapcount > 1? > > > > Maybe, not because process_madvise syscall needs more previliedge(ie, > > PTRACE_MODE_ATTACH_FSCREDS) so I guess it would be more secure. > > So in that case, I want to rely on the LRU chance for shared pages. > > I don't want the behavior of an madvise command to change depending on > *how* the command is invoked. MADV_PAGEOUT should do the same thing > regardless. If you want to allow purging of shared pages as well, > please add a new MADV_PAGEOUT_ALL or something and require a privilege > to use it. > I would like to have a way to pageout the shared pages and MADV_PAGEOUT_ALL approach looks fine to me.