mm: gup: FOLL_MM_SYNC: handle FOLL_MM_SYNC in can_read_pin_swap_page()

Since the introduction of FOLL_MM_SYNC we cannot unconditionally take
pins on PageKsm anymore, it depends if FOLL_MM_SYNC is set.

So this extracts the PageKsm knowledge from can_read_pin_swap_page()
and it requires the caller to handle the race with KSM creating a
PageKsm.

KSM also needs do its part and ensure it never converts in place a
!PageKsm to PageKsm if there's any oustanding pins and that it won't
change a pgtable from a wrprotected PageAnon to a wrprotected PageKsm
if there were any outstanding pins on the PageAnon.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
5 files changed