Re: Do we need to unrevert "fs: do not prefault sys_write() user buffer pages"?

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

 



On Tue, Jun 22, 2021 at 03:36:22PM +0000, Al Viro wrote:
> On Tue, Jun 22, 2021 at 03:27:43PM +0000, Al Viro wrote:
> > On Tue, Jun 22, 2021 at 04:20:40PM +0100, David Howells wrote:
> > 
> > > and wondering if the iov_iter_fault_in_readable() is actually effective.  Yes,
> > > it can make sure that the page we're intending to modify is dragged into the
> > > pagecache and marked uptodate so that it can be read from, but is it possible
> > > for the page to then get reclaimed before we get to
> > > iov_iter_copy_from_user_atomic()?  a_ops->write_begin() could potentially take
> > > a long time, say if it has to go and get a lock/lease from a server.
> > 
> > Yes, it is.  So what?  We'll just retry.  You *can't* take faults while holding
> > some pages locked; not without shitloads of deadlocks.
> 
> Note that the revert you propose is going to do fault-in anyway; we really can't
> avoid it.  The only thing it does is optimistically trying without that the
> first time around, which is going to be an overall loss exactly in "slow
> write_begin" case.  If source pages are absent, you'll get copyin fail;
> iov_iter_copy_from_user_atomic() (or its replacement) is disabling pagefaults
> itself.

Let's not overstate the case.  I think for the vast majority of write()
calls, the data being written has recently been accessed.  So this
userspace access is unnecessary.  From the commentary around commits
00a3d660cbac and 998ef75ddb57, it seems that Dave had a CPU which was
particularly inefficient at accessing userspace.  I assume Intel have
fixed that by now and the extra load is in the noise.  But maybe enough
CPU errata have accumulated that it's slow again?



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux