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=-0.7 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 CA4BEC0044D for ; Thu, 12 Mar 2020 00:18:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA1A420753 for ; Thu, 12 Mar 2020 00:18:54 +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="CTmv1WbC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA1A420753 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 10BBE6B0005; Wed, 11 Mar 2020 20:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BC5F6B0006; Wed, 11 Mar 2020 20:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EED1A6B0007; Wed, 11 Mar 2020 20:18:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id D4AFD6B0005 for ; Wed, 11 Mar 2020 20:18:53 -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 94D6C180AD838 for ; Thu, 12 Mar 2020 00:18:53 +0000 (UTC) X-FDA: 76584799746.18.kiss29_3080d43598b02 X-HE-Tag: kiss29_3080d43598b02 X-Filterd-Recvd-Size: 5034 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Mar 2020 00:18:53 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id u10so1769587pjy.0 for ; Wed, 11 Mar 2020 17:18:53 -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=rHVaFHVzaDmEJe7g5XdZRMkddh2li149yn+7WgUo1hDrngPnX7T/OiWVmvs6fj7Lds FlV1UKG5DlGWTnj8T5yfTIl7WGPeF2i0BbOqRYxIDqCbSMzAucYfPdtAFDggsXlzLVP+ vuIhZhvCfrycW9pq4cVp8K+/0KrPv6D2oWd7v+mKEiqMQdqfMbxoOV4owLC/t7t0i/yn JCJcK4rR9XBCrlbm/4GyF23WevzzeDFSvwk3t2/PjkB90yTQHbZePoxBNTuxeobcfhEP pmK57QeAZnwwWlDkBQ6E0tfyQBIQgRAgvbsePdhG4w26AqRvE9wkmy98k7afhg993+D2 MNkQ== X-Gm-Message-State: ANhLgQ08S4f/usFRmXARe/cfWZUFAtzQ1r/kqd1P7Dvy7M7yoZe5oT6G OftSNr+utdcfJynr+JM7sD8= X-Google-Smtp-Source: ADFU+vswgzmTTZ+Ndgojb02iVVr1CeuBSH2oCPmu9usv/GeJ3lOAqfCO9/e4U6/j8JekpPsIXF3D5w== 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) 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 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?