Re: [PATCH v3 0/1] mm: introduce put_user_page*(), placeholder versions
From: Ira Weiny
Date: Tue Mar 12 2019 - 14:41:06 EST
On Tue, Mar 12, 2019 at 05:23:21AM +0000, Christopher Lameter wrote:
> On Mon, 11 Mar 2019, Dave Chinner wrote:
>
> > > Direct IO on a mmapped file backed page doesnt make any sense.
> >
> > People have used it for many, many years as zero-copy data movement
> > pattern. i.e. mmap the destination file, use direct IO to DMA direct
> > into the destination file page cache pages, fdatasync() to force
> > writeback of the destination file.
>
> Well we could make that more safe through a special API that designates a
> range of pages in a file in the same way as for RDMA. This is inherently
> not reliable as we found out.
I'm not following. What API was not reliable? In[2] we had ideas on such an
API but AFAIK these have not been tried.
>From what I have seen the above is racy and is prone to the issues John has
seen. The difference is that Direct IO has a smaller window than RDMA. (Or at
least I thought we already established that?)
"And also remember that while RDMA might be the case at least some
people care about here it really isn't different from any of the other
gup + I/O cases, including doing direct I/O to a mmap area. The only
difference in the various cases is how long the area should be pinned
down..."
-- Christoph Hellwig : https://lkml.org/lkml/2018/10/1/591
>
> > Now we have copy_file_range() to optimise this sort of data
> > movement, the need for games with mmap+direct IO largely goes away.
> > However, we still can't just remove that functionality as it will
> > break lots of random userspace stuff...
>
> It is already broken and unreliable. Are there really "lots" of these
> things around? Can we test this by adding a warning in the kernel and see
> where it actually crops up?
IMHO I don't think that the copy_file_range() is going to carry us through the
next wave of user performance requirements. RDMA, while the first, is not the
only technology which is looking to have direct access to files. XDP is
another.[1]
Ira
[1] https://www.kernel.org/doc/html/v4.19-rc1/networking/af_xdp.html
[2] https://lore.kernel.org/lkml/20190205175059.GB21617@xxxxxxxxxxxxxxxxxxxxxxxxx/