• Peter Xu's avatar
    selftests/mm: add tests for RO pinning vs fork() · 760aee0b
    Peter Xu authored
    Add a test suite (with 10 more sub-tests) to cover RO pinning against
    fork() over uffd-wp.  It covers both:
    
      (1) Early CoW test in fork() when page pinned,
      (2) page unshare due to RO longterm pin.
    
    They are:
    
      Testing wp-fork-pin on anon... done
      Testing wp-fork-pin on shmem... done
      Testing wp-fork-pin on shmem-private... done
      Testing wp-fork-pin on hugetlb... done
      Testing wp-fork-pin on hugetlb-private... done
      Testing wp-fork-pin-with-event on anon... done
      Testing wp-fork-pin-with-event on shmem... done
      Testing wp-fork-pin-with-event on shmem-private... done
      Testing wp-fork-pin-with-event on hugetlb... done
      Testing wp-fork-pin-with-event on hugetlb-private... done
    
    CONFIG_GUP_TEST needed or they'll be skipped.
    
      Testing wp-fork-pin on anon... skipped [reason: Possibly CONFIG_GUP_TEST missing or unprivileged]
    
    Note that the major test goal is on private memory, but no hurt to also run
    all of them over shared because shared memory should work the same.
    
    Link: https://lkml.kernel.org/r/20230417195317.898696-7-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Mika Penttilä <mpenttil@redhat.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Nadav Amit <nadav.amit@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    760aee0b
uffd-unit-tests.c 30.4 KB