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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 D4E52C10DCE for ; Thu, 12 Mar 2020 15:15:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F42C20674 for ; Thu, 12 Mar 2020 15:15:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qCTFDwlu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F42C20674 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 2AEC66B0008; Thu, 12 Mar 2020 11:15:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 238416B000A; Thu, 12 Mar 2020 11:15:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1280A6B000C; Thu, 12 Mar 2020 11:15:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id EB2FB6B0008 for ; Thu, 12 Mar 2020 11:15:55 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1C37180ACEE4 for ; Thu, 12 Mar 2020 15:15:55 +0000 (UTC) X-FDA: 76587060270.18.cork85_1698bb1372d5f X-HE-Tag: cork85_1698bb1372d5f X-Filterd-Recvd-Size: 5252 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Mar 2020 15:15:55 +0000 (UTC) Received: by mail-oi1-f179.google.com with SMTP id d63so5808202oig.6 for ; Thu, 12 Mar 2020 08:15:55 -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=mySMJKQJlYiABBiBjCIKTSvSJlHgjO0tQmk97VggfrUuGVwYS8HJW9gj0WC2UoixBP A/A6IbAGazzhT0FHf+UW0C1QL5AEn00UjwQbx0pgBmDA2CPLjMvEoKRsCltVmSaWCQ10 DhA43+W51A7EWpuJfQfhSEKUOzqv/H5E3G3pp6RX2tzKd1uVo3rrfoXIqzLSCaOwhXh9 j1ESSjy2hkqeeaj/x97v2QMBujNENB649M6h8zlHlcvolxTI2YGIWoQskYuA4Za5o8aB jX5Nr97UXqZo4jQsBl05krUHFa7+wh4Fp5kw/hZ/Eoz+xGeKoGbeWzQDETgKpWFZw1yi LnNw== X-Gm-Message-State: ANhLgQ3UVouhTeYBpVMFaW2ec4Ppmh9Q7By4nk/4NYIXvGo+TJKAMZ/B HWXNYLqyZMkbbP8jsHsPv1+75oLf8Ql0ON4yyQaEOA== X-Google-Smtp-Source: ADFU+vs+ysDXPcJo7dLHwfyBtgXL38eh6PqTY+/HIUA4DU/FG8I4c7ikrHwIMLCoYVOWfG1TnP8Zk7M3cn13Ju51Bz8= 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" 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 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.