On Mon, Sep 28, 2020 at 12:29:55PM -0700, Linus Torvalds wrote:...
I think this is really hard to use and ugly. My thinking has been to
just stick:
if (flags & FOLL_LONGTERM)
flags |= FOLL_FORCE | FOLL_WRITE
In pin_user_pages(). It would make the driver API cleaner. If we can
do a bit better somehow by not COW'ing for certain VMA's as you
explained then all the better, but not my primary goal..
Basically, I think if a driver is using FOLL_LONGTERM | FOLL_PIN we
should guarentee that driver a consistent MM and take the gup_fast
performance hit to do it.
AFAICT the giant wack of other cases not using FOLL_LONGTERM really
shouldn't care about read-decoherence. For those cases the user should
really not be racing write's with data under read-only pin, and the
new COW logic looks like it solves the other issues with this.
I know Jann/John have been careful to not have special behaviors for
the DMA case, but I think it makes sense here. It is actually different.