Re: [PATCH v6 12/14] selftests/mm: remove READ_ONLY_THP_FOR_FS code from guard-regions

2026-06-16 Thread David Hildenbrand (Arm)
On 5/17/26 15:54, 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 
> Acked-by: David Hildenbrand (Arm) 
> Cc: Al Viro 
> Cc: Baolin Wang 
> Cc: Barry Song 
> Cc: Chris Mason 
> Cc: Christian Brauner 
> Cc: David Sterba 
> Cc: Dev Jain 
> Cc: Jan Kara 
> Cc: Lance Yang 
> Cc: Liam Howlett 
> Cc: Lorenzo Stoakes 
> Cc: Matthew Wilcox (Oracle) 
> Cc: Michal Hocko 
> Cc: Mike Rapoport 
> Cc: Nico Pache 
> Cc: Ryan Roberts 
> Cc: Shuah Khan 
> Cc: Song Liu 
> Cc: Suren Baghdasaryan 
> Cc: Vlastimil Babka 
> ---

Skimmed over it and nothing jumped at me

Acked-by: David Hildenbrand (Arm) 

-- 
Cheers,

David



[PATCH v6 12/14] selftests/mm: remove READ_ONLY_THP_FOR_FS code from guard-regions

2026-05-17 Thread Zi Yan
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 
Acked-by: David Hildenbrand (Arm) 
Cc: Al Viro 
Cc: Baolin Wang 
Cc: Barry Song 
Cc: Chris Mason 
Cc: Christian Brauner 
Cc: David Sterba 
Cc: Dev Jain 
Cc: Jan Kara 
Cc: Lance Yang 
Cc: Liam Howlett 
Cc: Lorenzo Stoakes 
Cc: Matthew Wilcox (Oracle) 
Cc: Michal Hocko 
Cc: Mike Rapoport 
Cc: Nico Pache 
Cc: Ryan Roberts 
Cc: Shuah Khan 
Cc: Song Liu 
Cc: Suren Baghdasaryan 
Cc: Vlastimil Babka 
---
 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 48e8b1539be3a..1176398919537 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);
-   }
-
ptr = mmap_(self, variant, NULL, size, PROT_READ, 0, 0);
ASSERT_NE(ptr, MAP_FAILED);
 
@@ -2237,9 +2226,10 @@ TEST_F(guard_regions, collapse)
/*
 * Now collapse the entire region. This should fail in all cases.
 *
-* The madvise() call will also fail if CONFIG_READ_ONLY_THP_FOR_FS is
-* not set for the local file case, but we can't differentiate whether
-* this occurred or if the collapse was rightly rejected.
+* The madvise() call will also fail if the file system does not support
+* large folio or the supported orders do not include PMD_ORDER for the
+* local file case, but we can't differentiate whether this occurred or
+* if the collapse was rightly rejected.
 */
EXPECT_NE(madvise(ptr, size, MADV_COLLAPSE), 0);
 
-- 
2.53.0