* [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions
@ 2026-07-22 9:11 Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported Muhammad Usama Anjum
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
Several MM selftests report failures when the test environment lacks
an underlying prerequisite, such as fallocate() support, MADV_REMOVE,
local page-cache semantics, or swap.
This series converts those unsupported cases to SKIP while preserving
failures for unexpected errors. It also allows migration tests to retry
transient move_pages() failures.
Tested on an arm64 Ampere system using an NFS root filesystem. The MM
selftest run completed with no failures or errors anymore. Also verified
on x86_64 to make sure they don't cause any unexpected errors.
Muhammad Usama Anjum (5):
selftests/mm: skip COW tmpfile cases when fallocate() is unsupported
selftests/mm: skip guard hole-punch test if MADV_REMOVE is unsupported
selftests/mm: skip khugepaged swap tests without swap
selftests/mm: skip page-cache hwpoison tests on NFS
selftests/mm: retry migration failures for the full runtime
tools/testing/selftests/mm/cow.c | 9 ++++--
tools/testing/selftests/mm/guard-regions.c | 10 ++++--
tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++
tools/testing/selftests/mm/memory-failure.c | 13 ++++++--
tools/testing/selftests/mm/migration.c | 34 +++++++++++++--------
5 files changed, 81 insertions(+), 19 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
@ 2026-07-22 9:11 ` Muhammad Usama Anjum
2026-07-23 6:27 ` Sarthak Sharma
2026-07-22 9:11 ` [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE " Muhammad Usama Anjum
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
The tmpfile-backed COW cases allocate a one-page file with fallocate()
before exercising private and shared mappings. When the filesystem
backing tmpfile() does not implement fallocate(), setup fails with
EOPNOTSUPP and no COW behavior is exercised.
This occurs when the temporary directory resides on a filesystem with
limited allocation support, such as NFSv3. Reporting a failure adds
noise because the test prerequisite is absent rather than the COW
implementation being broken.
Report EOPNOTSUPP as a skip. Continue treating every other fallocate()
error as a failure so unexpected setup regressions remain visible.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/mm/cow.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 0c627ea89ff7b..c1b8920e29342 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -1718,8 +1718,13 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)
/* File consists of a single page filled with zeroes. */
if (fallocate(fd, 0, 0, pagesize)) {
- ksft_perror("fallocate() failed");
- log_test_result(KSFT_FAIL);
+ if (errno == EOPNOTSUPP) {
+ ksft_print_msg("fallocate() not supported by filesystem\n");
+ log_test_result(KSFT_SKIP);
+ } else {
+ ksft_perror("fallocate() failed");
+ log_test_result(KSFT_FAIL);
+ }
goto close;
}
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE is unsupported
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported Muhammad Usama Anjum
@ 2026-07-22 9:11 ` Muhammad Usama Anjum
2026-07-23 6:52 ` Sarthak Sharma
2026-07-22 9:11 ` [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap Muhammad Usama Anjum
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
The hole_punch case verifies that guard regions survive MADV_REMOVE and
that the backing range is punched out. MADV_REMOVE delegates the hole
punch to the backing filesystem, which may reject the operation with
EOPNOTSUPP.
That result means the test cannot establish the state whose guard
semantics it intends to validate. Treating the missing filesystem
capability as a guard-region failure creates a false regression.
Unmap the range and skip only when MADV_REMOVE fails with EOPNOTSUPP.
Preserve the assertion for all other errors so failures on supported
configurations remain visible.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/mm/guard-regions.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
index b21df3040b1c7..5c8ec3ca75d7d 100644
--- a/tools/testing/selftests/mm/guard-regions.c
+++ b/tools/testing/selftests/mm/guard-regions.c
@@ -1912,7 +1912,7 @@ TEST_F(guard_regions, hole_punch)
{
const unsigned long page_size = self->page_size;
char *ptr;
- int i;
+ int i, ret;
if (variant->backing == ANON_BACKED)
SKIP(return, "Truncation test specific to file-backed");
@@ -1944,8 +1944,12 @@ TEST_F(guard_regions, hole_punch)
}
/* Now hole punch the guarded region. */
- ASSERT_EQ(madvise(&ptr[3 * page_size], 4 * page_size,
- MADV_REMOVE), 0);
+ ret = madvise(&ptr[3 * page_size], 4 * page_size, MADV_REMOVE);
+ if (ret == -1 && errno == EOPNOTSUPP) {
+ ASSERT_EQ(munmap(ptr, 10 * page_size), 0);
+ SKIP(return, "MADV_REMOVE not supported by filesystem");
+ }
+ ASSERT_EQ(ret, 0);
/* Ensure guard regions remain. */
for (i = 0; i < 10; i++) {
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE " Muhammad Usama Anjum
@ 2026-07-22 9:11 ` Muhammad Usama Anjum
2026-07-22 12:16 ` Sarthak Sharma
2026-07-22 9:11 ` [PATCH RESEND v1 4/5] selftests/mm: skip page-cache hwpoison tests on NFS Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 5/5] selftests/mm: retry migration failures for the full runtime Muhammad Usama Anjum
4 siblings, 1 reply; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
collapse_swapin_single_pte and collapse_max_ptes_swap require
MADV_PAGEOUT to replace anonymous pages with swap entries. On swapless
systems there is no backing store with which to create those entries, so
check_swap() reports missing setup rather than broken khugepaged behavior.
Swapless configurations are common on Android and other constrained
test devices. Failing these cases obscures actionable results from the
rest of the khugepaged suite.
Check /proc/swaps before either swap-dependent case and skip when no
active swap area exists. With swap present, retain the existing
MADV_PAGEOUT and swap-entry assertions unchanged.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
index 10e8dedcb087d..a152cec59fcbd 100644
--- a/tools/testing/selftests/mm/khugepaged.c
+++ b/tools/testing/selftests/mm/khugepaged.c
@@ -100,6 +100,28 @@ static void skip(const char *msg)
exit_status = KSFT_SKIP;
}
+static bool is_swap_enabled(void)
+{
+ char buf[MAX_LINE_LENGTH];
+ FILE *file;
+ bool enabled = false;
+
+ file = fopen("/proc/swaps", "r");
+ if (!file)
+ return false;
+
+ if (!fgets(buf, sizeof(buf), file))
+ goto out;
+
+ /* Check for first active swap entry. */
+ if (fgets(buf, sizeof(buf), file))
+ enabled = true;
+
+out:
+ fclose(file);
+ return enabled;
+}
+
static void save_settings(void)
{
ksft_print_msg("Save THP and khugepaged settings...");
@@ -734,6 +756,12 @@ static void collapse_swapin_single_pte(struct collapse_context *c, struct mem_op
{
void *p;
+ if (!is_swap_enabled()) {
+ skip("No active swap");
+ ksft_test_result_report(exit_status, "%s\n", __func__);
+ return;
+ }
+
p = ops->setup_area(1);
ops->fault(p, 0, hpage_pmd_size);
@@ -760,6 +788,12 @@ static void collapse_max_ptes_swap(struct collapse_context *c, struct mem_ops *o
int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
void *p;
+ if (!is_swap_enabled()) {
+ skip("No active swap");
+ ksft_test_result_report(exit_status, "%s\n", __func__);
+ return;
+ }
+
p = ops->setup_area(1);
ops->fault(p, 0, hpage_pmd_size);
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH RESEND v1 4/5] selftests/mm: skip page-cache hwpoison tests on NFS
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
` (2 preceding siblings ...)
2026-07-22 9:11 ` [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap Muhammad Usama Anjum
@ 2026-07-22 9:11 ` Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 5/5] selftests/mm: retry migration failures for the full runtime Muhammad Usama Anjum
4 siblings, 0 replies; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
The clean_pagecache and dirty_pagecache cases use shared file-backed
mappings to exercise page-cache memory-failure recovery. These checks
assume local filesystem writeback and error-reporting semantics.
On NFS, the hard dirty-page case can complete hwpoison injection and
recovery, then report a delayed writeback error when the file is closed.
That failure reflects NFS writeback behavior rather than the page-cache
recovery path targeted by the test.
Extend the existing filesystem prerequisite check to reject NFS and
close the descriptor before skipping. Other filesystem types retain the
existing injection and recovery checks.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/mm/memory-failure.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/memory-failure.c b/tools/testing/selftests/mm/memory-failure.c
index 032ed952057c6..2e77f58406868 100644
--- a/tools/testing/selftests/mm/memory-failure.c
+++ b/tools/testing/selftests/mm/memory-failure.c
@@ -272,6 +272,11 @@ static int get_fs_type(int fd)
return ret ? 0 : (int)fs.f_type;
}
+static bool file_backed_test_supported(int fs_type)
+{
+ return fs_type && fs_type != TMPFS_MAGIC && fs_type != NFS_SUPER_MAGIC;
+}
+
TEST_F(memory_failure, clean_pagecache)
{
int fd;
@@ -283,8 +288,10 @@ TEST_F(memory_failure, clean_pagecache)
if (fd < 0)
SKIP(return, "failed to open test file.\n");
fs_type = get_fs_type(fd);
- if (!fs_type || fs_type == TMPFS_MAGIC)
+ if (!file_backed_test_supported(fs_type)) {
+ close(fd);
SKIP(return, "unsupported filesystem :%x\n", fs_type);
+ }
addr = mmap(0, self->page_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
@@ -325,8 +332,10 @@ TEST_F(memory_failure, dirty_pagecache)
if (fd < 0)
SKIP(return, "failed to open test file.\n");
fs_type = get_fs_type(fd);
- if (!fs_type || fs_type == TMPFS_MAGIC)
+ if (!file_backed_test_supported(fs_type)) {
+ close(fd);
SKIP(return, "unsupported filesystem :%x\n", fs_type);
+ }
addr = mmap(0, self->page_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH RESEND v1 5/5] selftests/mm: retry migration failures for the full runtime
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
` (3 preceding siblings ...)
2026-07-22 9:11 ` [PATCH RESEND v1 4/5] selftests/mm: skip page-cache hwpoison tests on NFS Muhammad Usama Anjum
@ 2026-07-22 9:11 ` Muhammad Usama Anjum
4 siblings, 0 replies; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 9:11 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: Muhammad Usama Anjum
move_pages() migration is best effort and may temporarily leave a page
unmigrated when another task faults on the folio during unmapping. The
migration test currently tolerates 100 consecutive partial failures,
but a busy machine can exhaust those retries in a fraction of a second
and fail long before the intended 20-second runtime expires.
This is especially visible in the shared-anon cases, where every worker
process continuously accesses the same mapping. The retry count then
measures syscall rate rather than whether the test can exercise a
successful migration entry.
Retry positive move_pages() results for the full runtime and record the
per-page status. Pass if at least one migration succeeds, and report the
last status before failing if no migration makes progress. Continue to
fail immediately for syscall-level errors.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/mm/migration.c | 34 +++++++++++++++++---------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/tools/testing/selftests/mm/migration.c b/tools/testing/selftests/mm/migration.c
index 29f7492453d43..19b4cef65f345 100644
--- a/tools/testing/selftests/mm/migration.c
+++ b/tools/testing/selftests/mm/migration.c
@@ -7,7 +7,7 @@
#include "kselftest_harness.h"
#include "hugepage_settings.h"
-#include <strings.h>
+#include <string.h>
#include <pthread.h>
#include <numa.h>
#include <numaif.h>
@@ -20,7 +20,6 @@
#define TWOMEG (2<<20)
#define RUNTIME (20)
-#define MAX_RETRIES 100
#define ALIGN(x, a) (((x) + (a - 1)) & (~((a) - 1)))
HUGETLB_SETUP_DEFAULT_PAGES(1)
@@ -110,7 +109,8 @@ int migrate(uint64_t *ptr, int n1, int n2)
int ret, tmp;
int status = 0;
struct timespec ts1, ts2;
- int failures = 0;
+ int last_status = 0;
+ unsigned long successes = 0;
if (clock_gettime(CLOCK_MONOTONIC, &ts1))
return -1;
@@ -119,23 +119,33 @@ int migrate(uint64_t *ptr, int n1, int n2)
if (clock_gettime(CLOCK_MONOTONIC, &ts2))
return -1;
- if (ts2.tv_sec - ts1.tv_sec >= RUNTIME)
- return 0;
+ if (ts2.tv_sec - ts1.tv_sec >= RUNTIME) {
+ if (successes)
+ return 0;
+ if (last_status < 0)
+ printf("No page migration succeeded: %s (%d)\n",
+ strerror(-last_status), last_status);
+ else
+ printf("No page migration succeeded: status %d\n",
+ last_status);
+ return -2;
+ }
+
+ status = 0;
ret = move_pages(0, 1, (void **) &ptr, &n2, &status,
MPOL_MF_MOVE_ALL);
if (ret) {
if (ret > 0) {
- /* Migration is best effort; try again */
- if (++failures < MAX_RETRIES)
- continue;
- printf("Didn't migrate %d pages\n", ret);
- }
- else
+ /* Migration is best effort; try again. */
+ last_status = status;
+ continue;
+ } else {
perror("Couldn't migrate pages");
+ }
return -2;
}
- failures = 0;
+ successes++;
tmp = n2;
n2 = n1;
n1 = tmp;
--
2.47.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap
2026-07-22 9:11 ` [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap Muhammad Usama Anjum
@ 2026-07-22 12:16 ` Sarthak Sharma
2026-07-22 14:05 ` Muhammad Usama Anjum
0 siblings, 1 reply; 12+ messages in thread
From: Sarthak Sharma @ 2026-07-22 12:16 UTC (permalink / raw)
To: Muhammad Usama Anjum, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Hi Usama!
On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
> collapse_swapin_single_pte and collapse_max_ptes_swap require
> MADV_PAGEOUT to replace anonymous pages with swap entries. On swapless
> systems there is no backing store with which to create those entries, so
> check_swap() reports missing setup rather than broken khugepaged behavior.
>
> Swapless configurations are common on Android and other constrained
> test devices. Failing these cases obscures actionable results from the
> rest of the khugepaged suite.
>
> Check /proc/swaps before either swap-dependent case and skip when no
> active swap area exists. With swap present, retain the existing
> MADV_PAGEOUT and swap-entry assertions unchanged.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
> ---
> tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
> index 10e8dedcb087d..a152cec59fcbd 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -100,6 +100,28 @@ static void skip(const char *msg)
> exit_status = KSFT_SKIP;
> }
>
> +static bool is_swap_enabled(void)
> +{
> + char buf[MAX_LINE_LENGTH];
> + FILE *file;
> + bool enabled = false;
> +
> + file = fopen("/proc/swaps", "r");
> + if (!file)
> + return false;
> +
> + if (!fgets(buf, sizeof(buf), file))
> + goto out;
> +
> + /* Check for first active swap entry. */
> + if (fgets(buf, sizeof(buf), file))
> + enabled = true;
> +
> +out:
> + fclose(file);
> + return enabled;
> +}
> +
> static void save_settings(void)
> {
> ksft_print_msg("Save THP and khugepaged settings...");
> @@ -734,6 +756,12 @@ static void collapse_swapin_single_pte(struct collapse_context *c, struct mem_op
> {
> void *p;
>
> + if (!is_swap_enabled()) {
> + skip("No active swap");
Can we prefix this skip message with a #, as recommended for KTAP
output? Right now it is printing like this:
# Run test: collapse_swapin_single_pte (khugepaged:anon)
No active swap
ok 16 # SKIP collapse_swapin_single_pte
#
# Run test: collapse_swapin_single_pte (madvise:anon)
No active swap
ok 17 # SKIP collapse_swapin_single_pte
#
# Run test: collapse_max_ptes_swap (khugepaged:anon)
No active swap
ok 18 # SKIP collapse_max_ptes_swap
#
# Run test: collapse_max_ptes_swap (madvise:anon)
No active swap
> + ksft_test_result_report(exit_status, "%s\n", __func__);
> + return;
> + }
> +
> p = ops->setup_area(1);
> ops->fault(p, 0, hpage_pmd_size);
>
> @@ -760,6 +788,12 @@ static void collapse_max_ptes_swap(struct collapse_context *c, struct mem_ops *o
> int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
> void *p;
>
> + if (!is_swap_enabled()) {
> + skip("No active swap");
Same here.
> + ksft_test_result_report(exit_status, "%s\n", __func__);
> + return;
> + }
> +
> p = ops->setup_area(1);
> ops->fault(p, 0, hpage_pmd_size);
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap
2026-07-22 12:16 ` Sarthak Sharma
@ 2026-07-22 14:05 ` Muhammad Usama Anjum
2026-07-23 5:08 ` Sarthak Sharma
0 siblings, 1 reply; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-22 14:05 UTC (permalink / raw)
To: Sarthak Sharma, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: usama.anjum
Hi,
Thank you for review.
On 22/07/2026 1:16 pm, Sarthak Sharma wrote:
> Hi Usama!
>
> On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
>> collapse_swapin_single_pte and collapse_max_ptes_swap require
>> MADV_PAGEOUT to replace anonymous pages with swap entries. On swapless
>> systems there is no backing store with which to create those entries, so
>> check_swap() reports missing setup rather than broken khugepaged behavior.
>>
>> Swapless configurations are common on Android and other constrained
>> test devices. Failing these cases obscures actionable results from the
>> rest of the khugepaged suite.
>>
>> Check /proc/swaps before either swap-dependent case and skip when no
>> active swap area exists. With swap present, retain the existing
>> MADV_PAGEOUT and swap-entry assertions unchanged.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
>> ---
>> tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>>
>> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
>> index 10e8dedcb087d..a152cec59fcbd 100644
>> --- a/tools/testing/selftests/mm/khugepaged.c
>> +++ b/tools/testing/selftests/mm/khugepaged.c
>> @@ -100,6 +100,28 @@ static void skip(const char *msg)
>> exit_status = KSFT_SKIP;
>> }
>>
>> +static bool is_swap_enabled(void)
>> +{
>> + char buf[MAX_LINE_LENGTH];
>> + FILE *file;
>> + bool enabled = false;
>> +
>> + file = fopen("/proc/swaps", "r");
>> + if (!file)
>> + return false;
>> +
>> + if (!fgets(buf, sizeof(buf), file))
>> + goto out;
>> +
>> + /* Check for first active swap entry. */
>> + if (fgets(buf, sizeof(buf), file))
>> + enabled = true;
>> +
>> +out:
>> + fclose(file);
>> + return enabled;
>> +}
>> +
>> static void save_settings(void)
>> {
>> ksft_print_msg("Save THP and khugepaged settings...");
>> @@ -734,6 +756,12 @@ static void collapse_swapin_single_pte(struct collapse_context *c, struct mem_op
>> {
>> void *p;
>>
>> + if (!is_swap_enabled()) {
>> + skip("No active swap");
>
> Can we prefix this skip message with a #, as recommended for KTAP
> output? Right now it is printing like this:
It looks like `skip()` is not being prefixed with `#` in this test
because of how it is currently used.
The `skip()` helper itself should probably be fixed, but that can be
handled in a separate follow-up patch. This test is not fully
TAP-compliant at the moment: the normal pass/fail output appears to be
compliant, while the skip-related messages are not. Would it make sense
to address that separately from this series?
Also when we run the whole mm suite using ./run_vmtests.sh, it appends an extra
# in start of the output which we get by running normal test directly. Its
controversial already that we are applying TAP styling to suite level and test
level as well. So non-compliant skip in this test makes overall output
compliant.
>
> # Run test: collapse_swapin_single_pte (khugepaged:anon)
> No active swap
> ok 16 # SKIP collapse_swapin_single_pte
> #
> # Run test: collapse_swapin_single_pte (madvise:anon)
> No active swap
> ok 17 # SKIP collapse_swapin_single_pte
> #
> # Run test: collapse_max_ptes_swap (khugepaged:anon)
> No active swap
> ok 18 # SKIP collapse_max_ptes_swap
> #
> # Run test: collapse_max_ptes_swap (madvise:anon)
> No active swap
>
>
>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>> + return;
>> + }
>> +
>> p = ops->setup_area(1);
>> ops->fault(p, 0, hpage_pmd_size);
>>
>> @@ -760,6 +788,12 @@ static void collapse_max_ptes_swap(struct collapse_context *c, struct mem_ops *o
>> int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
>> void *p;
>>
>> + if (!is_swap_enabled()) {
>> + skip("No active swap");
>
> Same here.
>
>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>> + return;
>> + }
>> +
>> p = ops->setup_area(1);
>> ops->fault(p, 0, hpage_pmd_size);
>>
>
--
Thanks,
Usama
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap
2026-07-22 14:05 ` Muhammad Usama Anjum
@ 2026-07-23 5:08 ` Sarthak Sharma
2026-07-23 11:36 ` Muhammad Usama Anjum
0 siblings, 1 reply; 12+ messages in thread
From: Sarthak Sharma @ 2026-07-23 5:08 UTC (permalink / raw)
To: Muhammad Usama Anjum, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
On 7/22/26 7:35 PM, Muhammad Usama Anjum wrote:
> Hi,
>
> Thank you for review.
>
> On 22/07/2026 1:16 pm, Sarthak Sharma wrote:
>> Hi Usama!
>>
>> On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
>>> collapse_swapin_single_pte and collapse_max_ptes_swap require
>>> MADV_PAGEOUT to replace anonymous pages with swap entries. On swapless
>>> systems there is no backing store with which to create those entries, so
>>> check_swap() reports missing setup rather than broken khugepaged behavior.
>>>
>>> Swapless configurations are common on Android and other constrained
>>> test devices. Failing these cases obscures actionable results from the
>>> rest of the khugepaged suite.
>>>
>>> Check /proc/swaps before either swap-dependent case and skip when no
>>> active swap area exists. With swap present, retain the existing
>>> MADV_PAGEOUT and swap-entry assertions unchanged.
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
>>> ---
>>> tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++++++
>>> 1 file changed, 34 insertions(+)
>>>
>>> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
>>> index 10e8dedcb087d..a152cec59fcbd 100644
>>> --- a/tools/testing/selftests/mm/khugepaged.c
>>> +++ b/tools/testing/selftests/mm/khugepaged.c
>>> @@ -100,6 +100,28 @@ static void skip(const char *msg)
>>> exit_status = KSFT_SKIP;
>>> }
>>>
>>> +static bool is_swap_enabled(void)
>>> +{
>>> + char buf[MAX_LINE_LENGTH];
>>> + FILE *file;
>>> + bool enabled = false;
>>> +
>>> + file = fopen("/proc/swaps", "r");
>>> + if (!file)
>>> + return false;
>>> +
>>> + if (!fgets(buf, sizeof(buf), file))
>>> + goto out;
>>> +
>>> + /* Check for first active swap entry. */
>>> + if (fgets(buf, sizeof(buf), file))
>>> + enabled = true;
>>> +
>>> +out:
>>> + fclose(file);
>>> + return enabled;
>>> +}
>>> +
>>> static void save_settings(void)
>>> {
>>> ksft_print_msg("Save THP and khugepaged settings...");
>>> @@ -734,6 +756,12 @@ static void collapse_swapin_single_pte(struct collapse_context *c, struct mem_op
>>> {
>>> void *p;
>>>
>>> + if (!is_swap_enabled()) {
>>> + skip("No active swap");
>>
>> Can we prefix this skip message with a #, as recommended for KTAP
>> output? Right now it is printing like this:
> It looks like `skip()` is not being prefixed with `#` in this test
> because of how it is currently used.
>
> The `skip()` helper itself should probably be fixed, but that can be
> handled in a separate follow-up patch. This test is not fully
> TAP-compliant at the moment: the normal pass/fail output appears to be
> compliant, while the skip-related messages are not. Would it make sense
> to address that separately from this series?
I think there's nothing wrong with the skip() helper. Normal pass/fail
output appears to be TAP compliant because there's a ksft_print_msg(...)
call before calling pass()/fail() helpers. If we move the
ksft_print_msg() line before the is_swap_enabled() check, we'll get
output which is TAP compliant, something like this:
# Run test: collapse_swapin_single_pte (khugepaged:anon)
# Swapout one page... No active swap
ok 16 # SKIP collapse_swapin_single_pte
#
# Run test: collapse_swapin_single_pte (madvise:anon)
# Swapout one page... No active swap
ok 17 # SKIP collapse_swapin_single_pte
#
# Run test: collapse_max_ptes_swap (khugepaged:anon)
# Swapout 65 of 512 pages... No active swap
ok 18 # SKIP collapse_max_ptes_swap
#
# Run test: collapse_max_ptes_swap (madvise:anon)
# Swapout 65 of 512 pages... No active swap
ok 19 # SKIP collapse_max_ptes_swap
>
> Also when we run the whole mm suite using ./run_vmtests.sh, it appends an extra
> # in start of the output which we get by running normal test directly. Its
> controversial already that we are applying TAP styling to suite level and test
> level as well. So non-compliant skip in this test makes overall output
> compliant.>
>>
>> # Run test: collapse_swapin_single_pte (khugepaged:anon)
>> No active swap
>> ok 16 # SKIP collapse_swapin_single_pte
>> #
>> # Run test: collapse_swapin_single_pte (madvise:anon)
>> No active swap
>> ok 17 # SKIP collapse_swapin_single_pte
>> #
>> # Run test: collapse_max_ptes_swap (khugepaged:anon)
>> No active swap
>> ok 18 # SKIP collapse_max_ptes_swap
>> #
>> # Run test: collapse_max_ptes_swap (madvise:anon)
>> No active swap
>>
>>
>>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>>> + return;
>>> + }
>>> +
>>> p = ops->setup_area(1);
>>> ops->fault(p, 0, hpage_pmd_size);
>>>
>>> @@ -760,6 +788,12 @@ static void collapse_max_ptes_swap(struct collapse_context *c, struct mem_ops *o
>>> int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
>>> void *p;
>>>
>>> + if (!is_swap_enabled()) {
>>> + skip("No active swap");
>>
>> Same here.
>>
>>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>>> + return;
>>> + }
>>> +
>>> p = ops->setup_area(1);
>>> ops->fault(p, 0, hpage_pmd_size);
>>>
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported
2026-07-22 9:11 ` [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported Muhammad Usama Anjum
@ 2026-07-23 6:27 ` Sarthak Sharma
0 siblings, 0 replies; 12+ messages in thread
From: Sarthak Sharma @ 2026-07-23 6:27 UTC (permalink / raw)
To: Muhammad Usama Anjum, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
> The tmpfile-backed COW cases allocate a one-page file with fallocate()
> before exercising private and shared mappings. When the filesystem
> backing tmpfile() does not implement fallocate(), setup fails with
> EOPNOTSUPP and no COW behavior is exercised.
>
> This occurs when the temporary directory resides on a filesystem with
> limited allocation support, such as NFSv3. Reporting a failure adds
> noise because the test prerequisite is absent rather than the COW
> implementation being broken.
>
> Report EOPNOTSUPP as a skip. Continue treating every other fallocate()
> error as a failure so unexpected setup regressions remain visible.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
I've tested this patch on a QEMU with ramfs mounted over /tmp, which
does not support fallocate().
Before applying the patch, 3 tests (Basic COW with tmpfile, R/O longterm
GUP pin with tmpfile and R/O longterm GUP-fast pin with tmpfile) failed
with
# fallocate() failed: Operation not supported (95)
After applying the patch, these tests are skipped.
Tested-by: Sarthak Sharma <sarthak.sharma@arm.com>
> ---
> tools/testing/selftests/mm/cow.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
> index 0c627ea89ff7b..c1b8920e29342 100644
> --- a/tools/testing/selftests/mm/cow.c
> +++ b/tools/testing/selftests/mm/cow.c
> @@ -1718,8 +1718,13 @@ static void run_with_tmpfile(non_anon_test_fn fn, const char *desc)
>
> /* File consists of a single page filled with zeroes. */
> if (fallocate(fd, 0, 0, pagesize)) {
> - ksft_perror("fallocate() failed");
> - log_test_result(KSFT_FAIL);
> + if (errno == EOPNOTSUPP) {
> + ksft_print_msg("fallocate() not supported by filesystem\n");
> + log_test_result(KSFT_SKIP);
> + } else {
> + ksft_perror("fallocate() failed");
> + log_test_result(KSFT_FAIL);
> + }
> goto close;
> }
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE is unsupported
2026-07-22 9:11 ` [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE " Muhammad Usama Anjum
@ 2026-07-23 6:52 ` Sarthak Sharma
0 siblings, 0 replies; 12+ messages in thread
From: Sarthak Sharma @ 2026-07-23 6:52 UTC (permalink / raw)
To: Muhammad Usama Anjum, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
> The hole_punch case verifies that guard regions survive MADV_REMOVE and
> that the backing range is punched out. MADV_REMOVE delegates the hole
> punch to the backing filesystem, which may reject the operation with
> EOPNOTSUPP.
>
> That result means the test cannot establish the state whose guard
> semantics it intends to validate. Treating the missing filesystem
> capability as a guard-region failure creates a false regression.
>
> Unmap the range and skip only when MADV_REMOVE fails with EOPNOTSUPP.
> Preserve the assertion for all other errors so failures on supported
> configurations remain visible.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
I tested this patch on a QEMU by mounting ramfs over /tmp and then
running guard-regions from /tmp.
Before the patch:
# RUN guard_regions.file.hole_punch ...
# guard-regions.c:1947:hole_punch:Expected madvise(&ptr[3 * page_size],
4 * page_size, MADV_REMOVE) (-1) == 0 (0)
# hole_punch: Test terminated by assertion
# FAIL guard_regions.file.hole_punch
not ok 84 guard_regions.file.hole_punch
After the patch:
# RUN guard_regions.file.hole_punch ...
# SKIP MADV_REMOVE not supported by filesystem
# OK guard_regions.file.hole_punch
ok 84 guard_regions.file.hole_punch # SKIP MADV_REMOVE not supported by
filesystem
Tested-by: Sarthak Sharma <sarthak.sharma@arm.com>
> ---
> tools/testing/selftests/mm/guard-regions.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
> index b21df3040b1c7..5c8ec3ca75d7d 100644
> --- a/tools/testing/selftests/mm/guard-regions.c
> +++ b/tools/testing/selftests/mm/guard-regions.c
> @@ -1912,7 +1912,7 @@ TEST_F(guard_regions, hole_punch)
> {
> const unsigned long page_size = self->page_size;
> char *ptr;
> - int i;
> + int i, ret;
>
> if (variant->backing == ANON_BACKED)
> SKIP(return, "Truncation test specific to file-backed");
> @@ -1944,8 +1944,12 @@ TEST_F(guard_regions, hole_punch)
> }
>
> /* Now hole punch the guarded region. */
> - ASSERT_EQ(madvise(&ptr[3 * page_size], 4 * page_size,
> - MADV_REMOVE), 0);
> + ret = madvise(&ptr[3 * page_size], 4 * page_size, MADV_REMOVE);
> + if (ret == -1 && errno == EOPNOTSUPP) {
> + ASSERT_EQ(munmap(ptr, 10 * page_size), 0);
> + SKIP(return, "MADV_REMOVE not supported by filesystem");
> + }
> + ASSERT_EQ(ret, 0);
>
> /* Ensure guard regions remain. */
> for (i = 0; i < 10; i++) {
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap
2026-07-23 5:08 ` Sarthak Sharma
@ 2026-07-23 11:36 ` Muhammad Usama Anjum
0 siblings, 0 replies; 12+ messages in thread
From: Muhammad Usama Anjum @ 2026-07-23 11:36 UTC (permalink / raw)
To: Sarthak Sharma, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Shuah Khan, Zi Yan,
Baolin Wang, Nico Pache, Ryan Roberts, Dev Jain, Barry Song,
Lance Yang, Usama Arif, Miaohe Lin, Naoya Horiguchi, linux-mm,
linux-kselftest, linux-kernel
Cc: usama.anjum
On 23/07/2026 6:08 am, Sarthak Sharma wrote:
>
>
> On 7/22/26 7:35 PM, Muhammad Usama Anjum wrote:
>> Hi,
>>
>> Thank you for review.
>>
>> On 22/07/2026 1:16 pm, Sarthak Sharma wrote:
>>> Hi Usama!
>>>
>>> On 7/22/26 2:41 PM, Muhammad Usama Anjum wrote:
>>>> collapse_swapin_single_pte and collapse_max_ptes_swap require
>>>> MADV_PAGEOUT to replace anonymous pages with swap entries. On swapless
>>>> systems there is no backing store with which to create those entries, so
>>>> check_swap() reports missing setup rather than broken khugepaged behavior.
>>>>
>>>> Swapless configurations are common on Android and other constrained
>>>> test devices. Failing these cases obscures actionable results from the
>>>> rest of the khugepaged suite.
>>>>
>>>> Check /proc/swaps before either swap-dependent case and skip when no
>>>> active swap area exists. With swap present, retain the existing
>>>> MADV_PAGEOUT and swap-entry assertions unchanged.
>>>>
>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
>>>> ---
>>>> tools/testing/selftests/mm/khugepaged.c | 34 +++++++++++++++++++++++++
>>>> 1 file changed, 34 insertions(+)
>>>>
>>>> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
>>>> index 10e8dedcb087d..a152cec59fcbd 100644
>>>> --- a/tools/testing/selftests/mm/khugepaged.c
>>>> +++ b/tools/testing/selftests/mm/khugepaged.c
>>>> @@ -100,6 +100,28 @@ static void skip(const char *msg)
>>>> exit_status = KSFT_SKIP;
>>>> }
>>>>
>>>> +static bool is_swap_enabled(void)
>>>> +{
>>>> + char buf[MAX_LINE_LENGTH];
>>>> + FILE *file;
>>>> + bool enabled = false;
>>>> +
>>>> + file = fopen("/proc/swaps", "r");
>>>> + if (!file)
>>>> + return false;
>>>> +
>>>> + if (!fgets(buf, sizeof(buf), file))
>>>> + goto out;
>>>> +
>>>> + /* Check for first active swap entry. */
>>>> + if (fgets(buf, sizeof(buf), file))
>>>> + enabled = true;
>>>> +
>>>> +out:
>>>> + fclose(file);
>>>> + return enabled;
>>>> +}
>>>> +
>>>> static void save_settings(void)
>>>> {
>>>> ksft_print_msg("Save THP and khugepaged settings...");
>>>> @@ -734,6 +756,12 @@ static void collapse_swapin_single_pte(struct collapse_context *c, struct mem_op
>>>> {
>>>> void *p;
>>>>
>>>> + if (!is_swap_enabled()) {
>>>> + skip("No active swap");
>>>
>>> Can we prefix this skip message with a #, as recommended for KTAP
>>> output? Right now it is printing like this:
>> It looks like `skip()` is not being prefixed with `#` in this test
>> because of how it is currently used.
>>
>> The `skip()` helper itself should probably be fixed, but that can be
>> handled in a separate follow-up patch. This test is not fully
>> TAP-compliant at the moment: the normal pass/fail output appears to be
>> compliant, while the skip-related messages are not. Would it make sense
>> to address that separately from this series?
>
> I think there's nothing wrong with the skip() helper. Normal pass/fail
> output appears to be TAP compliant because there's a ksft_print_msg(...)
> call before calling pass()/fail() helpers. If we move the
> ksft_print_msg() line before the is_swap_enabled() check, we'll get
> output which is TAP compliant, something like this:
Makes sense. I'll fix it in the next version.
>
> # Run test: collapse_swapin_single_pte (khugepaged:anon)
> # Swapout one page... No active swap
> ok 16 # SKIP collapse_swapin_single_pte
> #
> # Run test: collapse_swapin_single_pte (madvise:anon)
> # Swapout one page... No active swap
> ok 17 # SKIP collapse_swapin_single_pte
> #
> # Run test: collapse_max_ptes_swap (khugepaged:anon)
> # Swapout 65 of 512 pages... No active swap
> ok 18 # SKIP collapse_max_ptes_swap
> #
> # Run test: collapse_max_ptes_swap (madvise:anon)
> # Swapout 65 of 512 pages... No active swap
> ok 19 # SKIP collapse_max_ptes_swap
>
>>
>> Also when we run the whole mm suite using ./run_vmtests.sh, it appends an extra
>> # in start of the output which we get by running normal test directly. Its
>> controversial already that we are applying TAP styling to suite level and test
>> level as well. So non-compliant skip in this test makes overall output
>> compliant.>
>>>
>>> # Run test: collapse_swapin_single_pte (khugepaged:anon)
>>> No active swap
>>> ok 16 # SKIP collapse_swapin_single_pte
>>> #
>>> # Run test: collapse_swapin_single_pte (madvise:anon)
>>> No active swap
>>> ok 17 # SKIP collapse_swapin_single_pte
>>> #
>>> # Run test: collapse_max_ptes_swap (khugepaged:anon)
>>> No active swap
>>> ok 18 # SKIP collapse_max_ptes_swap
>>> #
>>> # Run test: collapse_max_ptes_swap (madvise:anon)
>>> No active swap
>>>
>>>
>>>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>>>> + return;
>>>> + }
>>>> +
>>>> p = ops->setup_area(1);
>>>> ops->fault(p, 0, hpage_pmd_size);
>>>>
>>>> @@ -760,6 +788,12 @@ static void collapse_max_ptes_swap(struct collapse_context *c, struct mem_ops *o
>>>> int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
>>>> void *p;
>>>>
>>>> + if (!is_swap_enabled()) {
>>>> + skip("No active swap");
>>>
>>> Same here.
>>>
>>>> + ksft_test_result_report(exit_status, "%s\n", __func__);
>>>> + return;
>>>> + }
>>>> +
>>>> p = ops->setup_area(1);
>>>> ops->fault(p, 0, hpage_pmd_size);
>>>>
>>>
>>
>
--
Thanks,
Usama
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-07-23 11:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-22 9:11 [PATCH RESEND v1 0/5] selftests/mm: Handle unsupported and transient test conditions Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 1/5] selftests/mm: skip COW tmpfile cases when fallocate() is unsupported Muhammad Usama Anjum
2026-07-23 6:27 ` Sarthak Sharma
2026-07-22 9:11 ` [PATCH RESEND v1 2/5] selftests/mm: skip guard hole-punch test if MADV_REMOVE " Muhammad Usama Anjum
2026-07-23 6:52 ` Sarthak Sharma
2026-07-22 9:11 ` [PATCH RESEND v1 3/5] selftests/mm: skip khugepaged swap tests without swap Muhammad Usama Anjum
2026-07-22 12:16 ` Sarthak Sharma
2026-07-22 14:05 ` Muhammad Usama Anjum
2026-07-23 5:08 ` Sarthak Sharma
2026-07-23 11:36 ` Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 4/5] selftests/mm: skip page-cache hwpoison tests on NFS Muhammad Usama Anjum
2026-07-22 9:11 ` [PATCH RESEND v1 5/5] selftests/mm: retry migration failures for the full runtime Muhammad Usama Anjum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®