Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Dev Jain <dev.jain@arm.com>
To: Wei Yang <richard.weiyang@gmail.com>,
	akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org
Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/mm: close fd on write error
Date: Wed, 20 May 2026 09:21:48 +0530	[thread overview]
Message-ID: <20518530-12e3-4731-9b4a-54cc950239e2@arm.com> (raw)
In-Reply-To: <20260520020336.28914-1-richard.weiyang@gmail.com>



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 <richard.weiyang@gmail.com>
> ---
>  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 <dev.jain@arm.com>


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".

>  


  reply	other threads:[~2026-05-20  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20  2:03 [PATCH] selftests/mm: close fd on write error Wei Yang
2026-05-20  3:51 ` Dev Jain [this message]
2026-05-20  9:38   ` Wei Yang
2026-05-22  0:49     ` Andrew Morton
2026-05-24  1:48       ` Wei Yang
2026-05-21  0:54 ` SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20518530-12e3-4731-9b4a-54cc950239e2@arm.com \
    --to=dev.jain@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=richard.weiyang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox