Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1090864ybl; Fri, 16 Aug 2019 08:44:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFH+WxVZqNvJekUKgzwhP/PB6eGYHtvIcJcl9pZ+aCYOlqWKel3+ppTg4094+cSOVBHDu7 X-Received: by 2002:a63:ec13:: with SMTP id j19mr8237628pgh.369.1565970298824; Fri, 16 Aug 2019 08:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565970298; cv=none; d=google.com; s=arc-20160816; b=utsK2T76ymsHc8VNoIl1RWKVjLklvBIdpC7/BVLDXc1+30xNLxaCofEVyaeanwTrJM VEftseDWACOS5iKkrt7e16ohszClMaNhaU1oge119MjCEPtoDbg0YpSVnFlDG+CJ50Nd jR85/y709lhNuAPHGTvYqdrRUkT62BNKadwtOb7dNKgCW1JfpUIX6Z7zPLqbpCaoO2kR C80C+uMyZUBaT/X51ImY+bUOBOOGBI0cpPRWWYQhqqRuAe/TXL+gAT/5tBcXGhZEN3OU mIhKgGBd7G7oU4ZY+unJBb9L9panrgKehPMNbkIvA0J0+rQpOtJd1q3rORnlPjtOE/js gg/A== 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; bh=npnFKN1+FCtk1l8QBtys4XusVzBb7uFO+cSnOyNqXjY=; b=D7rZnkMW6VUcmFWZNlWhG/E1sMCZKLdQ2bdqWMVX3/QW8AgWVjJspBJyCguvm59OWc u8YcLLIR+09b++IgIbF9b79taW6cLTc29LL0hBVel6B8SWETlhu6NJfO4upr7MS/H+lE j3yzIWxcFTkAkhayhQuMlq0rwN4pHoyG5NAuGHnFD+4ePQfN9ug5Nnh7wp+881pyAfEa sJXtY3dy5VQuEvUTP6qnRD63dmkfCOrkiifoqCQ0UC3PzCsh2SC/d/rP8cN8i7O5t25+ 5bRhZl+lqoc0oitbq+dpZ8guamz/AuWHdPvvCm44ajwlzByQCSrBgA+9fyS2DYuAsSRr gh1g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n23si4044664pgv.163.2019.08.16.08.44.43; Fri, 16 Aug 2019 08:44:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbfHPPoG (ORCPT + 99 others); Fri, 16 Aug 2019 11:44:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:60226 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727311AbfHPPoG (ORCPT ); Fri, 16 Aug 2019 11:44:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B42A1AD0F; Fri, 16 Aug 2019 15:44:04 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 1D8051E4009; Fri, 16 Aug 2019 17:44:04 +0200 (CEST) Date: Fri, 16 Aug 2019 17:44:04 +0200 From: Jan Kara To: Vlastimil Babka Cc: Jan Kara , John Hubbard , Ira Weiny , Andrew Morton , Christoph Hellwig , Dan Williams , Dave Chinner , Jason Gunthorpe , =?iso-8859-1?B?Suly9G1l?= Glisse , LKML , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [RFC PATCH 2/2] mm/gup: introduce vaddr_pin_pages_remote() Message-ID: <20190816154404.GF3041@quack2.suse.cz> References: <38d2ff2f-4a69-e8bd-8f7c-41f1dbd80fae@nvidia.com> <20190813210857.GB12695@iweiny-DESK2.sc.intel.com> <90e5cd11-fb34-6913-351b-a5cc6e24d85d@nvidia.com> <20190814234959.GA463@iweiny-DESK2.sc.intel.com> <2cbdf599-2226-99ae-b4d5-8909a0a1eadf@nvidia.com> <20190815132622.GG14313@quack2.suse.cz> <20190815133510.GA21302@quack2.suse.cz> <0d6797d8-1e04-1ebe-80a7-3d6895fe71b0@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0d6797d8-1e04-1ebe-80a7-3d6895fe71b0@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 16-08-19 10:47:21, Vlastimil Babka wrote: > On 8/15/19 3:35 PM, Jan Kara wrote: > >> > >> So when the GUP user uses MMU notifiers to stop writing to pages whenever > >> they are writeprotected with page_mkclean(), they don't really need page > >> pin - their access is then fully equivalent to any other mmap userspace > >> access and filesystem knows how to deal with those. I forgot out this case > >> when I wrote the above sentence. > >> > >> So to sum up there are three cases: > >> 1) DIO case - GUP references to pages serving as DIO buffers are needed for > >> relatively short time, no special synchronization with page_mkclean() or > >> munmap() => needs FOLL_PIN > >> 2) RDMA case - GUP references to pages serving as DMA buffers needed for a > >> long time, no special synchronization with page_mkclean() or munmap() > >> => needs FOLL_PIN | FOLL_LONGTERM > >> This case has also a special case when the pages are actually DAX. Then > >> the caller additionally needs file lease and additional file_pin > >> structure is used for tracking this usage. > >> 3) ODP case - GUP references to pages serving as DMA buffers, MMU notifiers > >> used to synchronize with page_mkclean() and munmap() => normal page > >> references are fine. > > IMHO the munlock lesson told us about another one, that's in the end equivalent > to 3) > > 4) pinning for struct page manipulation only => normal page references > are fine Right, it's good to have this for clarity. > > I want to add that I'd like to convert users in cases 1) and 2) from using > > GUP to using differently named function. Users in case 3) can stay as they > > are for now although ultimately I'd like to denote such use cases in a > > special way as well... > > So after 1/2/3 is renamed/specially denoted, only 4) keeps the current > interface? Well, munlock() code doesn't even use GUP, just follow_page(). I'd wait to see what's left after handling cases 1), 2), and 3) to decide about the interface for the remainder. Honza -- Jan Kara SUSE Labs, CR