On Tue, 24 Mar 2026 09:33:10 +0800 Chunyu Hu <[email protected]> wrote:
> There are several tests requires transprarent hugepages, when run on thp
> disabled kernel such as realtime kernel, there will be false negative.
> Mark those tests as skip when thp is not available.
Thanks, I updated mm.git's mm-unstable branch to this version.
> Chagnes in v6:
> - patch 3 add reviewed-by from Lorenzo
> - patch 4 handle the errno before and after close(), suggested by AI
Here's how v6 altered mm.git:
tools/testing/selftests/mm/vm_util.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--- a/tools/testing/selftests/mm/vm_util.c~b
+++ a/tools/testing/selftests/mm/vm_util.c
@@ -785,15 +785,23 @@ int unpoison_memory(unsigned long pfn)
void write_file(const char *path, const char *buf, size_t buflen)
{
- int fd;
+ int fd, saved_errno;
ssize_t numwritten;
+ if (buflen < 1)
+ ksft_exit_fail_msg("Incorrect buffer len: %zu\n", buflen);
fd = open(path, O_WRONLY);
if (fd == -1)
ksft_exit_fail_msg("%s open failed: %s\n", path,
strerror(errno));
numwritten = write(fd, buf, buflen - 1);
+ saved_errno = errno;
close(fd);
+ errno = saved_errno;
if (numwritten < 1)
- ksft_exit_fail_msg("Write failed\n");
+ ksft_exit_fail_msg("%s write(%s) failed: %s\n", path, buf,
+ strerror(errno));
+ if (numwritten != buflen - 1)
+ ksft_exit_fail_msg("%s write(%s) is truncated, expected %zu
bytes, got %zd bytes\n",
+ path, buf, buflen - 1, numwritten);
}
_