diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index 9c2a77752544..2e8e2a88a377 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -1193,7 +1193,7 @@ static int userfaultfd_minor_test(void) void *expected_page; char c; struct uffd_stats stats = { 0 }; - uint64_t req_features, features_out; + uint64_t features = UFFD_FEATURE_MINOR_HUGETLBFS; if (!test_uffdio_minor) return 0; @@ -1201,18 +1201,10 @@ static int userfaultfd_minor_test(void) printf("testing minor faults: "); fflush(stdout); - if (test_type == TEST_HUGETLB) - req_features = UFFD_FEATURE_MINOR_HUGETLBFS; - else if (test_type == TEST_SHMEM) - req_features = UFFD_FEATURE_MINOR_SHMEM; - else + if (uffd_test_ctx_clear() || uffd_test_ctx_init_ext(&features)) return 1; - - features_out = req_features; - if (uffd_test_ctx_clear() || uffd_test_ctx_init_ext(&features_out)) - return 1; - /* If kernel reports required features aren't supported, skip test. */ - if ((features_out & req_features) != req_features) { + /* If kernel reports the feature isn't supported, skip the test. */ + if (!(features & UFFD_FEATURE_MINOR_HUGETLBFS)) { printf("skipping test due to lack of feature support\n"); fflush(stdout); return 0; @@ -1445,7 +1437,6 @@ static void set_test_type(const char *type) map_shared = true; test_type = TEST_SHMEM; uffd_test_ops = &shmem_uffd_test_ops; - test_uffdio_minor = true; } else { err("Unknown test type: %s", type); }