Re: [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

From: Al Viro
Date: Sat Jun 12 2021 - 17:50:27 EST


On Sat, Jun 12, 2021 at 02:33:31PM -0700, Linus Torvalds wrote:

> That said, reads are obviously much easier, and I'd probably prefer
> the model for writes to be to not necessarily pre-fault anything at
> all, but just write to user space with page faults disabled.

*nod*
I don't like that write pre-fault model at all - note that unlike read
we'll end up with atomic operations, etc. and there's a plenty of
non-obvious ways for that to end up being costly, even assuming it
works correctly in all cases.

O_DIRECT case is a PITA - there we use GUP and there's no way
to tell GUP that in the current situation we do *NOT* want to hit
->fault()/->page_mkwrite()/etc. pagefault_disable() won't be even
noticed there...