Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1088320ybh; Wed, 11 Mar 2020 17:21:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtUEHeIU0HM/UwzsncMpVYV1dCsnGhznIp0yRxMaw2E8iLozfCpSw4huV81t24tOjVM/J3f X-Received: by 2002:a9d:6d96:: with SMTP id x22mr4440190otp.264.1583972471732; Wed, 11 Mar 2020 17:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583972471; cv=none; d=google.com; s=arc-20160816; b=GpjnoRkCZhsyPDC9l2Dok9Ii3WJNXwhf+U6cRowx7FMELL5oTsvA/XTdceUlfRTuzk YzJ++wq4tjGEf7fcjXSo8rPb9QLXsUgZC1k6rjxL9i89UjmDRxFwTqhEGdLA/Iryy1J2 dOf9a6CfkVthYx2wvXf4XyIGmPNewdmaRJwAZP7pxpChTzHzdCE0hWPpqLjv6ejJUqQ1 cxFXpSuG5/+uZiKo2RNrZ/1F9ySHI08QcYStTg6SBDeeuKikssS4Wgr1ljtQ2OC4MA/O wtK6+oFK+gQBwcW8GWsPL4l3XDQfi8u4t70bFCDtfCamJOtwZbXNnz0S1weVqHqbVUSa k7Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3isA1tVj1/AbpkkjvWlQtyvSTX5nP5eHnvOxHnKorV8=; b=XycjpnjzMP9Pb9VoawddWI00QDRlwzrTSYftd69NV1C2+aeZ87KeMFCdECOpFikO8m gau11vZC/tUHzFOJo6vqPEc0IKCuH+8BWHqmCyGQBgEBqBmLr4bMWWS9TpKqGg5OTWio FGwMpJ9KS3Wdpt6ZtI92ufgjct53cjVuRvEkkRlO94LyshZHzbi5x4afs8QWnBgcQXKK EEoRaQ411uFdDQo/fkeKrC9asEzABqCoGYiMu8YBAQVqHW1X17wvi5gmdKGrRyU6dLDA H065aWu21mTDVHfvHGdad+RHjtG3Lu8uBPfPzanCujEnX6x/gXZL+NE2BR1arYjApDtt yU9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CTmv1WbC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si1904470oig.116.2020.03.11.17.20.58; Wed, 11 Mar 2020 17:21:11 -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=fail header.i=@gmail.com header.s=20161025 header.b=CTmv1WbC; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731583AbgCLASz (ORCPT + 99 others); Wed, 11 Mar 2020 20:18:55 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:54578 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731448AbgCLASy (ORCPT ); Wed, 11 Mar 2020 20:18:54 -0400 Received: by mail-pj1-f67.google.com with SMTP id np16so1761611pjb.4 for ; Wed, 11 Mar 2020 17:18:52 -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=3isA1tVj1/AbpkkjvWlQtyvSTX5nP5eHnvOxHnKorV8=; b=CTmv1WbC0xrnbJRiKZdyBIyWeB+rGR+GvhHbj4LPGOcZbO9BgNdSpdcEj4aEJzBDQ3 Wuyu53x7TUcxik8cQa8+HFVGonAv4Tt7MJ2Syp1UHO6fcG7EK7nvUSWewSuRve7Aifcm TQ/rcpRnbKxpiKntiCFuy52Lu+CJggCblGtw6XhebnnlG6YVXx4bNS5Y9IkJGlSYiWYT 6rMl6wgO8Xra21nZvtOotLDc8/Rj72ak/4LziLxctggtPAhAWAoGtd4hmaFmVBQeEywY mNBnlBKmNSzWhk3w6lWphn1OcbKORmJ/PGy4n1Wh9C+V/0IMFN7TszpixfpkS2kPmalk IV2w== 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=3isA1tVj1/AbpkkjvWlQtyvSTX5nP5eHnvOxHnKorV8=; b=j8CM7kw27NdzXdWXBNTuprX/3g5unPl1pbOBcw3PLsHk4XQULFBIdT5ExUJFYRvAxu /OQ1dFRgfm60SWuc4aGCaHsse06IODUkIXoYsqry7FVrinaOxgueo8tRVNQveRJ4IXya PYOvxmVFPoWUQhhZZMZcuzWeEgYQ55LCi6r4ocx3fvjXrd1Gurgj3Z0GFMjlRB6PcX4J 1pMPo6Jo/JsjjfWVgBOM8N8PR6JmD0gLJ6sRc1dqh7W2yJdvnjOJF/kMd9wiRVjgi2Gk ekEwQWwigQ5HLhBvmcm1qqRYhJEE3W2lHWf5ui7MIU95iplgbHZZFmyquQMBon2eSMl2 YzvA== X-Gm-Message-State: ANhLgQ3w6pwKcl0QOTaaojP5NQlGeZ1pK9VN4OUqKjLwUiAe6SPEX5vq WQsHlmAZQ5PkYxiRWiklc245ZzgJ X-Received: by 2002:a17:90a:25c8:: with SMTP id k66mr1322789pje.90.1583972331962; Wed, 11 Mar 2020 17:18:51 -0700 (PDT) Received: from google.com ([2620:15c:211:1:3e01:2939:5992:52da]) by smtp.gmail.com with ESMTPSA id j21sm6477775pji.13.2020.03.11.17.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 17:18:50 -0700 (PDT) Date: Wed, 11 Mar 2020 17:18:49 -0700 From: Minchan Kim To: Shakeel Butt Cc: Michal Hocko , Dave Hansen , Jann Horn , Linux-MM , kernel list , Daniel Colascione , "Joel Fernandes (Google)" Subject: Re: interaction of MADV_PAGEOUT with CoW anonymous mappings? Message-ID: <20200312001849.GA96953@google.com> References: <20200310184814.GA8447@dhcp22.suse.cz> <20200310210906.GD8447@dhcp22.suse.cz> <20200311084513.GD23944@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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 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. With that, the manager process could give a hint to several processes and finally makes them paging out. What do you think?