Re: [PATCH 7.2 v4 12/12] selftests/mm: remove READ_ONLY_THP_FOR_FS code from guard-regions
From: David Hildenbrand (Arm)
Date: Fri Apr 24 2026 - 08:59:45 EST
On 4/24/26 04:49, Zi Yan wrote:
> Any file system with large folio support and the supported orders include
> PMD_ORDER can be used. There is no need to open a file with read-only.
>
> Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
> ---
> tools/testing/selftests/mm/guard-regions.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/guard-regions.c b/tools/testing/selftests/mm/guard-regions.c
> index 48e8b1539be3..117639891953 100644
> --- a/tools/testing/selftests/mm/guard-regions.c
> +++ b/tools/testing/selftests/mm/guard-regions.c
> @@ -2203,17 +2203,6 @@ TEST_F(guard_regions, collapse)
> if (variant->backing != ANON_BACKED)
> ASSERT_EQ(ftruncate(self->fd, size), 0);
>
> - /*
> - * We must close and re-open local-file backed as read-only for
> - * CONFIG_READ_ONLY_THP_FOR_FS to work.
> - */
> - if (variant->backing == LOCAL_FILE_BACKED) {
> - ASSERT_EQ(close(self->fd), 0);
> -
> - self->fd = open(self->path, O_RDONLY);
> - ASSERT_GE(self->fd, 0);
> - }
What if someone runs this with a filesystem that does not support large folios?
Would we want an allowlist for known-good fs'es, similar to how we handle
gup_longterm.c, and SKIP otherwise, because we know that MADV_COLLAPSE would
always fail for a different reason?
In any case, the test would not misbehave if passed an unsupported FS, so LGTM
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David