Re: [RESEND PATCH 1/4] selftests/mm/guard-regions: skip collapse test when thp not enabled
From: Lorenzo Stoakes (Oracle)
Date: Fri Mar 13 2026 - 11:42:12 EST
On Thu, Mar 12, 2026 at 07:40:24PM +0800, Chunyu Hu wrote:
> When thp is not available, just skip the collape tests to avoid the false
> positive.
>
> Without the change, run with a thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # # RUN guard_regions.file.multi_vma ...
> # # OK guard_regions.file.multi_vma
> # ok 89 guard_regions.file.multi_vma
> # # RUN guard_regions.file.basic ...
> # # OK guard_regions.file.basic
> # ok 90 guard_regions.file.basic
> # # FAILED: 87 / 90 tests passed.
> # # 17 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:3 xfail:0 xpass:0 skip:17 error:0
> # [FAIL]
> not ok 1 guard-regions # exit=1
> hwpoison_inject
> # SUMMARY: PASS=0 SKIP=0 FAIL=1
>
> With this change, run with thp disabled kernel:
> ./run_vmtests.sh -t madv_guard
> <snip/>
> # ok 90 guard_regions.file.basic
> # # PASSED: 90 / 90 tests passed.
> # # 20 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> # # Totals: pass:70 fail:0 xfail:0 xpass:0 skip:20 error:0
> # [PASS]
> ok 1 guard-regions
> hwpoison_inject
> # SUMMARY: PASS=1 SKIP=0 FAIL=0
> 1..1
> CC: Li Wang <liwang@xxxxxxxxxx>
> Signed-off-by: Chunyu Hu <chuhu@xxxxxxxxxx>
LGTM thanks, so:
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@xxxxxxxxxx>
> ---
> tools/testing/selftests/mm/guard-regions.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
> index dbd21d66d383..897af9c512f9 100644
> --- a/tools/testing/selftests/mm/guard-regions.c
> +++ b/tools/testing/selftests/mm/guard-regions.c
> @@ -21,6 +21,7 @@
> #include <sys/uio.h>
> #include <unistd.h>
> #include "vm_util.h"
> +#include "thp_settings.h"
>
> #include "../pidfd/pidfd.h"
>
> @@ -2195,6 +2196,9 @@ TEST_F(guard_regions, collapse)
> char *ptr;
> int i;
>
> + if (!thp_is_enabled())
> + SKIP(return, "Transparent Hugepages not available\n");
> +
> /* Need file to be correct size for tests for non-anon. */
> if (variant->backing != ANON_BACKED)
> ASSERT_EQ(ftruncate(self->fd, size), 0);
> --
> 2.53.0
>
Cheers, Lorenzo