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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 D4146C43464 for ; Fri, 18 Sep 2020 09:44:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 655E921D43 for ; Fri, 18 Sep 2020 09:44:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 655E921D43 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C4ADA6B0003; Fri, 18 Sep 2020 05:44:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFB116B0055; Fri, 18 Sep 2020 05:44:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0F116B005A; Fri, 18 Sep 2020 05:44:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 9CCC86B0003 for ; Fri, 18 Sep 2020 05:44:42 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3DA21A741 for ; Fri, 18 Sep 2020 09:44:42 +0000 (UTC) X-FDA: 77275697604.11.steam61_630af712712a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 1C3B9180F8B80 for ; Fri, 18 Sep 2020 09:44:42 +0000 (UTC) X-HE-Tag: steam61_630af712712a X-Filterd-Recvd-Size: 3692 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 09:44:41 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 88027ADBB; Fri, 18 Sep 2020 09:45:14 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id BF4351E12E1; Fri, 18 Sep 2020 11:44:39 +0200 (CEST) Date: Fri, 18 Sep 2020 11:44:39 +0200 From: Jan Kara To: Jason Gunthorpe Cc: Peter Xu , Linus Torvalds , John Hubbard , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification Message-ID: <20200918094439.GD18920@quack2.suse.cz> References: <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917181411.GA133226@xz-x1> <20200917190332.GB133226@xz-x1> <20200917200638.GM8409@ziepe.ca> <20200917214059.GA162800@xz-x1> <20200917220900.GO8409@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917220900.GO8409@ziepe.ca> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Thu 17-09-20 19:09:00, Jason Gunthorpe wrote: > On Thu, Sep 17, 2020 at 05:40:59PM -0400, Peter Xu wrote: > > On Thu, Sep 17, 2020 at 01:35:56PM -0700, Linus Torvalds wrote: > > > For that to happen, we'd need to have the vma flag so that we wouldn't > > > have any worry about non-pinners, but as you suggested, I think even > > > just a mm-wide counter - or flag - to deal with the fast-bup case is > > > likely perfectly sufficient. > > > > Would mm_struct.pinned_vm suffice? > > I think that could be a good long term goal > > IIRC last time we dug into the locked_vm vs pinned_vm mess it didn't > get fixed. There is a mix of both kinds, as you saw, and some > resistance I don't clearly remember to changing it. > > My advice for this -rc fix is to go with a single bit in the mm_struct > set on any call to pin_user_pages* > > Then only users using pin_user_pages and forking are the only ones who > would ever do extra COW on fork. I think that is OK for -rc, this > workload should be rare due to the various historical issues. Anyhow, > a slow down regression is better than a it is broken regression. Agreed. I really like the solution of not write-protecting pinned pages on fork(2). > This can be improved into a counter later. Due to the pinned_vm > accounting all call sites should have the mm_struct at unpin, but I > have a feeling it will take a alot of driver patches to sort it all > out. I somewhat fear that some of the users of pin_user_pages() don't bother with pinned_vm accounting exactly because they don't have mm_struct on unpin... Honza -- Jan Kara SUSE Labs, CR