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=-1.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 50428C2BB1D for ; Tue, 17 Mar 2020 17:20:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1273420738 for ; Tue, 17 Mar 2020 17:20:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lEwGPTTi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1273420738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 79FFE6B0005; Tue, 17 Mar 2020 13:20:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 750616B0006; Tue, 17 Mar 2020 13:20:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63F596B0007; Tue, 17 Mar 2020 13:20:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 48E296B0005 for ; Tue, 17 Mar 2020 13:20:27 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 38756181AC9C6 for ; Tue, 17 Mar 2020 17:20:27 +0000 (UTC) X-FDA: 76605518094.11.nail20_5b3d42a0eed29 X-HE-Tag: nail20_5b3d42a0eed29 X-Filterd-Recvd-Size: 4931 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 17:20:26 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id w3so9909101plz.5 for ; Tue, 17 Mar 2020 10:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nWbdbsJ13Q5NKkmy2CBTWFaOaDCn2fTrTpvwXFs+GyY=; b=lEwGPTTiBodJ9sKj25HMDSAH+JGZ1Rik23rCQNCodLP4iEnOC0bNp8B8qDNu12YXJo 9gEZ9Vt1sdRaowLp2xl+6jdAlX19IXAgb8NFCRehh5sh00+Wx1L4uX9P1f+h5+uT1+mY VPRvJi79Zfo06t/CT7prW2jBtYg+t5JIz+P0kyySyL5bFiHoY7zbnOK+jDERGWULzzuD z8ieD9+xWYTG3v3rz22x/Mj4BKmosjWf4SLAtaJWDoOiLy5Krsby3duOcz9pRT/K9QPn qtIOefoI9IK1dkmTNLE1c0FyADVlBv+xcBX+xc+MxvUlAt6y7sBveFJCz7zsaIRfLCBG GsDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=nWbdbsJ13Q5NKkmy2CBTWFaOaDCn2fTrTpvwXFs+GyY=; b=lyUAl8CACS9tzkJIW6wcEZbzI9KNt4gJo6B2Ujg1zO5Bv+l8U1z4Z2BhZvFYIxo/HW sof+6nxgmTM7OIAoyUgN5/4L/yEkgO5B3ZxbjOff0zv1hcTLfM1MAUoZzVHDckcxbv2a inTOTMjCo0kahtS3xylq4bmWzubWZbCK7I9EfWZyvGdZEccoO4aW0CuXFtF3h5BATyQt 4zp0OX77j4JAbtFj3HUjh2DOz7eOK0yHywiJemHhn14hOPxApqhNyXss0Jl589fqvzmu 5IJxbV0Ad65uMEysxCBBRsXJZFBlzqSxpHqeNERYTEC2uCWOCyJW9ixjc8UO0dd2Igfa uWfg== X-Gm-Message-State: ANhLgQ1QpnQw3ofzFxYbZrl20zXUkOClg8tCY0oVrt5ppN5LOPKCFA1g wMiOVqghmrWqRNG1zDOHL1w= X-Google-Smtp-Source: ADFU+vseSefs8izYUDjRT/iTG1UXiU8ssaQG0e/NgGwkksRz+2wSI0FaQYZpyo8m5MfQxiqTmCs9yA== X-Received: by 2002:a17:90a:5218:: with SMTP id v24mr273042pjh.90.1584465625132; Tue, 17 Mar 2020 10:20:25 -0700 (PDT) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id t60sm53380pjb.9.2020.03.17.10.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 10:20:23 -0700 (PDT) Date: Tue, 17 Mar 2020 10:20:22 -0700 From: Minchan Kim To: Michal Hocko Cc: Jann Horn , Linux-MM , kernel list , Daniel Colascione , Dave Hansen , "Joel Fernandes (Google)" , Andrew Morton Subject: Re: interaction of MADV_PAGEOUT with CoW anonymous mappings? Message-ID: <20200317172022.GD73302@google.com> References: <20200312201602.GA68817@google.com> <20200312204155.GE23944@dhcp22.suse.cz> <20200313020851.GD68817@google.com> <20200313080546.GA21007@dhcp22.suse.cz> <20200313205941.GA78185@google.com> <20200316092052.GD11482@dhcp22.suse.cz> <20200317014340.GA73302@google.com> <20200317071239.GB26018@dhcp22.suse.cz> <20200317150055.GC73302@google.com> <20200317155855.GS26018@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200317155855.GS26018@dhcp22.suse.cz> User-Agent: Mutt/1.12.2 (2019-09-21) 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, Mar 17, 2020 at 04:58:55PM +0100, Michal Hocko wrote: > On Tue 17-03-20 08:00:55, Minchan Kim wrote: > > On Tue, Mar 17, 2020 at 08:12:39AM +0100, Michal Hocko wrote: > [...] > > > Just to make it clear, are you really suggesting to special case > > > page_check_references for madvise path? > > > > > > > No, (page_mapcount() > 1) checks *effectively* fixes the performance > > bug as well as vulnerability issue. > > Ahh, ok then we are on the same page. You were replying to the part > where I have pointed out that you can control aging by these calls > and your response suggested that this is somehow undesirable behavior or > even a bug. Sorry about the confusing. I want to clarify my speaking. If we don't have vulnerability issue Jann raised, the performance issue Daniel pointed should be fixed by introducing a special flag in page_check_references from madvise path to avoid cleaning of access bit from other processes's pte. With it, we don't need to limit semantic of MADV_PAGEOUT as "exclusive page only" so that MADV_PAGEOUT will work *cold* shared pages as well as exclusive one. However, since we have the vulnerability issue, *unfortunately*, we need to make MADV_PAGEOUT's semantic working with only exclusive page. Thus, page_mapcount check in madvise patch will fix both issues *effectively*. Thanks.