Re: [PATCH] selftests: hugetlb_dio: Check for initial conditions to skip in the start

From: Muhammad Usama Anjum
Date: Fri Nov 08 2024 - 09:13:37 EST


On 11/8/24 3:49 PM, Donet Tom wrote:

> I think below changes are required.
>
> iff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c
> index 60001c142ce9..4b52106b8124 100644
> --- a/tools/testing/selftests/mm/hugetlb_dio.c
> +++ b/tools/testing/selftests/mm/hugetlb_dio.c
> @@ -44,6 +44,9 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
>         if (fd < 0)
>                 ksft_exit_fail_perror("Error opening file\n");
>  
> +       /* Get the free huge pages before allocation */
> +       free_hpage_b = get_free_hugepages();
> +
>         /* Allocate a hugetlb page */
>
>         orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0);
>
>         if (orig_buffer == MAP_FAILED) {
Please can you send a fixup patch as you have working test setup?
Otherwise I'll take it up and try to test on working setup before
posting the fixup patch. Please let me know.

>
>  With this change the tests are passing.
>
> ./tools/testing/selftests/mm/hugetlb_dio
>
> TAP version 131..4
> # No. Free pages before allocation : 100
> # No. Free pages after munmap : 100
> ok 1 : Huge pages freed successfully !
> # No. Free pages before allocation : 100
> # No. Free pages after munmap : 100
> ok 2 : Huge pages freed successfully !
> # No. Free pages before allocation : 100
> # No. Free pages after munmap : 100
> ok 3 : Huge pages freed successfully !
> # No. Free pages before allocation : 100
> # No. Free pages after munmap : 100
> ok 4 : Huge pages freed successfully !
> # Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Thanks
> Donet
>
>

--
BR,
Muhammad Usama Anjum