Re: [PATCH 3/3] userfaultfd/selftests: enable huegtlb remap and remove event testing

From: Mike Kravetz
Date: Fri Jan 28 2022 - 18:54:14 EST


On 1/28/22 15:34, Axel Rasmussen wrote:
> Besides the help text, looks correct to me. I applied the patches and
> ran the userfaultfd selftests, and everything seems to work properly.
>
> Reviewed-by: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
>
> On Fri, Jan 28, 2022 at 2:26 PM Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:
>>
>> With MADV_DONTNEED support added to hugetlb mappings, mremap testing
>> can also be enabled for hugetlb.
>>
>> Modify the tests to use madvise MADV_DONTNEED and MADV_REMOVE instead of
>> fallocate hole puch for releasing hugetlb pages.
>>
>> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>> ---
>> tools/testing/selftests/vm/userfaultfd.c | 67 ++++++++++++------------
>> 1 file changed, 34 insertions(+), 33 deletions(-)
>>
>> diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
>> index d3fd24f9fae8..f5578ef85560 100644
>> --- a/tools/testing/selftests/vm/userfaultfd.c
>> +++ b/tools/testing/selftests/vm/userfaultfd.c
>> @@ -88,7 +88,6 @@ static bool test_uffdio_minor = false;
>> static bool map_shared;
>> static int shm_fd;
>> static int huge_fd;
>> -static char *huge_fd_off0;
>> static unsigned long long *count_verify;
>> static int uffd = -1;
>> static int uffd_flags, finished, *pipefd;
>> @@ -124,9 +123,9 @@ const char *examples =
>> "./userfaultfd anon 100 99999\n\n"
>> "# Run share memory test on 1GiB region with 99 bounces:\n"
>> "./userfaultfd shmem 1000 99\n\n"
>> - "# Run hugetlb memory test on 256MiB region with 50 bounces (using /dev/hugepages/hugefile):\n"
>> + "# Run hugetlb memory test on 256MiB region with 50 bounces:\n"
>> "./userfaultfd hugetlb 256 50 /dev/hugepages/hugefile\n\n"
>
> We should remove the path from the line above here as well, right?
> Since for the hugetlb test type, we now just MAP_ANONYMOUS |
> MAP_HUGETLB, we don't open a file descriptor.
>

Yes, and I should also update run_vmtests.sh to not include file path.
The test just ignores the file path in this case.

Thanks,
--
Mike Kravetz