• Peter Xu's avatar
    selftests/mm: move uffd minor test to unit test · 62515b5f
    Peter Xu authored
    This moves the minor test to the new unit test.
    
    Rewrite the content check with char* opeartions to avoid fiddling with
    my_bcmp().
    
    Drop global vars test_uffdio_minor and test_collapse, just assume test them
    always in common code for now.
    
    OTOH make this single test into five tests:
    
      - minor test on [shmem, hugetlb] with wp=false
      - minor test on [shmem, hugetlb] with wp=true
      - minor test + collapse on shmem only
    
    One thing to mention that we used to test COLLAPSE+WP but that doesn't
    sound right at all.  It's possible it's silently broken but unnoticed
    because COLLAPSE is not part of the default test suite.
    
    Make the MADV_COLLAPSE test fail-able (by skip it when failing), because
    it's not guaranteed to success anyway.
    
    Drop a bunch of useless code after the move, because the unit test always
    use aligned num of pages and has nothing to do with n_cpus.
    
    Link: https://lkml.kernel.org/r/20230412164357.328779-1-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Cc: Zach O'Keefe <zokeefe@google.com>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Dmitry Safonov <0x7f454c46@gmail.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Mike Rapoport (IBM) <rppt@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    62515b5f
uffd-unit-tests.c 12.6 KB