Re: [RFC PATCH 2/2] mm/gup: introduce vaddr_pin_pages_remote()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 14-08-19 20:01:07, John Hubbard wrote:
> On 8/14/19 5:02 PM, John Hubbard wrote:
> > On 8/14/19 4:50 PM, Ira Weiny wrote:
> > > On Tue, Aug 13, 2019 at 05:56:31PM -0700, John Hubbard wrote:
> > > > On 8/13/19 5:51 PM, John Hubbard wrote:
> > > > > On 8/13/19 2:08 PM, Ira Weiny wrote:
> > > > > > On Mon, Aug 12, 2019 at 05:07:32PM -0700, John Hubbard wrote:
> > > > > > > On 8/12/19 4:49 PM, Ira Weiny wrote:
> > > > > > > > On Sun, Aug 11, 2019 at 06:50:44PM -0700, john.hubbard@xxxxxxxxx wrote:
> > > > > > > > > From: John Hubbard <jhubbard@xxxxxxxxxx>
> > > > > > > ...
> > > > > > Finally, I struggle with converting everyone to a new call.  It is more
> > > > > > overhead to use vaddr_pin in the call above because now the GUP code is going
> > > > > > to associate a file pin object with that file when in ODP we don't need that
> > > > > > because the pages can move around.
> > > > > 
> > > > > What if the pages in ODP are file-backed?
> > > > > 
> > > > 
> > > > oops, strike that, you're right: in that case, even the file system case is covered.
> > > > Don't mind me. :)
> > > 
> > > Ok so are we agreed we will drop the patch to the ODP code?  I'm going to keep
> > > the FOLL_PIN flag and addition in the vaddr_pin_pages.
> > > 
> > 
> > Yes. I hope I'm not overlooking anything, but it all seems to make sense to
> > let ODP just rely on the MMU notifiers.
> > 
> 
> Hold on, I *was* forgetting something: this was a two part thing, and
> you're conflating the two points, but they need to remain separate and
> distinct. There were:
> 
> 1. FOLL_PIN is necessary because the caller is clearly in the use case that
> requires it--however briefly they might be there. As Jan described it,
> 
> "Anything that gets page reference and then touches page data (e.g.
> direct IO) needs the new kind of tracking so that filesystem knows
> someone is messing with the page data." [1]

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.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux