userfaultfd: selftest: generalize read and poll
authorPeter Xu <[email protected]>
Fri, 26 Oct 2018 22:09:13 +0000 (15:09 -0700)
committerLinus Torvalds <[email protected]>
Fri, 26 Oct 2018 23:26:35 +0000 (16:26 -0700)
commit04d877319e2aa3895cc7998adb32de0967d3927b
tree4c2852a3c04a8be98df2847c999c45012f783f0a
parent439de0d7443789c688428429874b8e27f693c00e
userfaultfd: selftest: generalize read and poll

We do very similar things in read and poll modes, but we're copying the
codes around.  Share the codes properly on reading the message and
handling the page fault to make the code cleaner.  Meanwhile this solves
previous mismatch of behaviors between the two modes on that the old code:

- did not check EAGAIN case in read() mode
- ignored BOUNCE_VERIFY check in read() mode

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Peter Xu <[email protected]>
Acked-by: Mike Rapoport <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Jerome Glisse <[email protected]>
Cc: Zi Yan <[email protected]>
Cc: "Kirill A . Shutemov" <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: "Dr . David Alan Gilbert" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
tools/testing/selftests/vm/userfaultfd.c