Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1057893pxk; Fri, 18 Sep 2020 02:46:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOiVNR4Mdok36YuyGFvXHDwh6aeg/MCCUlP5abNSt1pxKEgEVjY/dNMgzjhQeTI4MDsPZG X-Received: by 2002:a17:906:4c84:: with SMTP id q4mr29629702eju.525.1600422370959; Fri, 18 Sep 2020 02:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600422370; cv=none; d=google.com; s=arc-20160816; b=QgKClqjIMocswD7exgUURfNU5pVNGFK1EE/10oJDt5hB1wkuI2SnGhZpWQtT9K0VAH O5Q17toyQWBEo73vHyXFmTegVzYs/SLPsalKB15+showXlJVK8bmdaWliDMEY/AggDBO IcPO+rSl4Jksmo8F/G9m0F5bRaJVkSMZrzv66ASRTdGePyR3cJUUpxa5qmZLPXMc7p2W UMgqKgFRKautiT4iw3O5h7i6KZtkwB+q9tPXD9ZkOadLu05YOxfKvxKCLffRi+QEwYZi xhrnKDl90EIiCrLOH9WUSLzAP/+6b+Uo7V3Ya0NjF0t82sN2R1cyvig2pHnc75dOKqXZ GIEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=I/i6/g/dCPTwYHkPmJCSow83ewG0EvucMcqJzPcYKvs=; b=Jj8N2KqZ2Bmv8tNXT5Rzx+IrHefZD76Gwcq0a1ZAmtm9jkep78TiX0DgBrnfrxoURn hq2E0DUte8rAGmYZalfoxwJ69Vcjhd/wMDkY0qXMclibLKmRzfIg/1OA5OZiyY7P37wr CkMNWeAkcDmVH91+waHQfSLMWNL/AYJgXgenriL5/J0/B8YykHh/JSPdesdB8SbUNZ3Z HC/8yy3vuykDFY0jwOWMvd8hsEW4yc7Ytfz3A44aFI3Xl1VzO9MiSvtcynVf53Jwgcwz YNTdsRwiVI4MZgvKwwJF/1MAOLj6tyYHWuRtwVZI2YFOA4a3ByPyxkIsXCcysjJiTzd0 maKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si1798035ejs.611.2020.09.18.02.45.47; Fri, 18 Sep 2020 02:46:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726149AbgIRJom (ORCPT + 99 others); Fri, 18 Sep 2020 05:44:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:47554 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgIRJom (ORCPT ); Fri, 18 Sep 2020 05:44:42 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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