On Wed, May 20, 2026 at 09:21:48AM +0530, Dev Jain wrote:
>
>
>On 20/05/26 7:33 am, Wei Yang wrote:
>> When create_pagecache_thp_and_fd() write returns error on
>> /proc/sys/vm/dropcache, it just "goto err_out_unlink", which left fd
>> still open.
>> 
>> Use "goto err_out_close" to close the fd.
>> 
>> Signed-off-by: Wei Yang <[email protected]>
>> ---
>>  tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c 
>> b/tools/testing/selftests/mm/split_huge_page_test.c
>> index 460fa1f606fd..f30402ece608 100644
>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
>> @@ -469,7 +469,7 @@ static int create_pagecache_thp_and_fd(const char 
>> *testfile, size_t fd_size,
>>      }
>>      if (write(*fd, "3", 1) != 1) {
>>              ksft_perror("write to drop_caches");
>> -            goto err_out_unlink;
>> +            goto err_out_close;
>>      }
>>      close(*fd);
>
>LGTM
>
>Reviewed-by: Dev Jain <[email protected]>
>
>
>I asked AI and it points to another problem:
>
>for (i = 0; i < nr_thps; i++) {
>       if (is_backed_by_folio(page_area + i * pagesize, 0,
>                              pagemap_fd, kpageflags_fd))
>               continue;
>       ksft_test_result_fail("THP %zu not split\n", i);
>}
>
>ksft_test_result_pass("Split PTE-mapped huge pages successful\n");
>
>"If one THP is not split, it prints FAIL, but then falls through and also 
>prints PASS.
>
>It should probably jump to out after the failure".
>

Thanks for AI.

It looks we should "goto out" after ksft_test_result_fail().

-- 
Wei Yang
Help you, Help me

Reply via email to