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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A69C7C433F5 for ; Tue, 21 Dec 2021 18:07:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33E656B007B; Tue, 21 Dec 2021 13:07:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EE1E6B007D; Tue, 21 Dec 2021 13:07:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B5876B0081; Tue, 21 Dec 2021 13:07:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id 086C26B007B for ; Tue, 21 Dec 2021 13:07:18 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BE5E78B767 for ; Tue, 21 Dec 2021 18:07:17 +0000 (UTC) X-FDA: 78942583314.01.70F9F3A Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf29.hostedemail.com (Postfix) with ESMTP id 1D7C7120068 for ; Tue, 21 Dec 2021 18:07:09 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EAE401F388; Tue, 21 Dec 2021 18:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1640110031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+aHVar+NDv9LhVgPKkE8yVeRcY+l7hvW45ogGvLvZqI=; b=NrRBSTtBkpGrNyBZf9DmkNb9e8BDxusII75XYLrNqgQo1pb7pJ5w6SCGU0UgXF7iumVT0p m0l5ry5Bgl7ncB2YD4osjIjL2RryHzgFtxxDtCVY5im5GJ8V97iouma+3xLsty74dAlf9g c8Likz9rmpEzqcH1Uj/tFeBhgXrgqrM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1640110031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+aHVar+NDv9LhVgPKkE8yVeRcY+l7hvW45ogGvLvZqI=; b=EQvIag3QDEARwfFqVfScA9TyRwLYYQtJ5j4IJSahIATSGzZfSZtnNNoBXqS5gebwGEhAk8 g8Hpif72xjDR3vDQ== Received: from quack2.suse.cz (unknown [10.163.28.18]) by relay2.suse.de (Postfix) with ESMTP id 8550EA3B8A; Tue, 21 Dec 2021 18:07:11 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id DBFFE1F2CEA; Tue, 21 Dec 2021 19:07:05 +0100 (CET) Date: Tue, 21 Dec 2021 19:07:05 +0100 From: Jan Kara To: David Hildenbrand Cc: Linus Torvalds , Jason Gunthorpe , Nadav Amit , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Message-ID: <20211221180705.GA32603@quack2.suse.cz> References: <4D97206A-3B32-4818-9980-8F24BC57E289@vmware.com> <5A7D771C-FF95-465E-95F6-CD249FE28381@vmware.com> <20211221010312.GC1432915@nvidia.com> <900b7d4a-a5dc-5c7b-a374-c4a8cc149232@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <900b7d4a-a5dc-5c7b-a374-c4a8cc149232@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1D7C7120068 X-Stat-Signature: dgt87b4w3uf3cug6he8gpmtr4bo1yoqn Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=NrRBSTtB; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=EQvIag3Q; spf=pass (imf29.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none X-HE-Tag: 1640110029-539300 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 21-12-21 18:40:30, David Hildenbrand wrote: > On 21.12.21 18:05, Linus Torvalds wrote: > > On Tue, Dec 21, 2021 at 12:58 AM David Hildenbrand wrote: > >> Note that I am trying to make also any kind of R/O pins on an anonymous > >> page work as expected as well, to fix any kind of GUP after fork() and > >> GUP before fork(). So taking a R/O pin on an !PageAnonExclusive() page > >> similarly has to make sure that the page is exclusive -- even if it's > >> mapped R/O (!). > > > > I do think the existing "maybe_pinned()" logic is fine for that. The > > "exclusive to this VM" bit can be used to *help* that decision - > > because only an exclusive page can be pinned - bit I don't think it > > should _replace_ that logic. > > The issue is that O_DIRECT uses FOLL_GET and cannot easily be changed to > FOLL_PIN unfortunately. So I'm *trying* to make it more generic such > that such corner cases can be handled as well correctly. But yeah, I'll > see where this goes ... O_DIRECT has to be fixed one way or the other. > > John H. mentioned that he wants to look into converting that to > FOLL_PIN. So maybe that will work eventually. For record we always intended (and still intend) to make O_DIRECT use FOLL_PIN. Just it is tricky because some users mix pages pinned with GUP and pages acquired through get_page() in a single bio (such as zero page) and thus it is non-trivial to do the right thing on IO completion (unpin or just put_page). Honza -- Jan Kara SUSE Labs, CR