]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/mm: remove READ_ONLY_THP_FOR_FS code from guard-regions
authorZi Yan <ziy@nvidia.com>
Sun, 17 May 2026 13:54:14 +0000 (09:54 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Jun 2026 18:37:16 +0000 (11:37 -0700)
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.

Link: https://lore.kernel.org/20260517135416.1434539-13-ziy@nvidia.com
Signed-off-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Mason <clm@fb.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/guard-regions.c

index 48e8b1539be3a27c110caeaf5eb576628334b9b5..117639891953724272db8f49afd1610627fe6ebd 100644 (file)
@@ -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);