Skip to contentSkip to conversation

selftests-mincore-fix-tmpfs-mincore-test-failure.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Apr 12, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests: mincore: fix tmpfs mincore test failure
has been removed from the -mm tree. Its filename was
selftests-mincore-fix-tmpfs-mincore-test-failure.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Baolin Wang <[email protected]>
Subject: selftests: mincore: fix tmpfs mincore test failure
Date: Mon, 7 Apr 2025 19:31:35 +0800

When running mincore test cases, I encountered the following failures:

"
mincore_selftest.c:359:check_tmpfs_mmap:Expected ra_pages (511) == 0 (0) mincore_selftest.c:360:check_tmpfs_mmap:Read-ahead pages found in memory
check_tmpfs_mmap: Test terminated by assertion
FAIL global.check_tmpfs_mmap
not ok 5 global.check_tmpfs_mmap
FAILED: 4 / 5 tests passed
"

The reason for the test case failure is that my system automatically enabled tmpfs large folio allocation by adding the 'transparent_hugepage_tmpfs=always' cmdline. However, the test case still expects the tmpfs mounted on /dev/shm to allocate small folios, which leads to assertion failures when verifying readahead pages.

As discussed with David, there's no reason to continue checking the readahead logic for tmpfs. Drop it to fix this issue.

Fixes d635ccdb435c ("mm: shmem: add a kernel command line to change the default huge policy for tmpfs")
Cc Barry Song <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Ryan Roberts <[email protected]>

---

 tools/testing/selftests/mincore/mincore_selftest.c |   16 +----------
 1 file changed, 2 insertions(+), 14 deletions(-)
tools/testing/selftests/mincore/mincore_selftest.c renamed from tools/testing/selftests/mincore/mincore_selftest.c~selftests-mincore-fix-tmpfs-mincore-test-failure +2 -14
@@ -286,8 +286,7 @@ out_free:
 
 /*
  * Test mincore() behavior on a page backed by a tmpfs file.  This test
- * performs the same steps as the previous one. However, we don't expect
- * any readahead in this case.
+ * performs the same steps as the previous one.
  */
 TEST(check_tmpfs_mmap)
 {
@@ -298,7 +297,6 @@ TEST(check_tmpfs_mmap)
 	int page_size;
 	int fd;
 	int i;
-	int ra_pages = 0;
 
 	page_size = sysconf(_SC_PAGESIZE);
 	vec_size = FILE_SIZE / page_size;
@@ -341,8 +339,7 @@ TEST(check_tmpfs_mmap)
 	}
 
 	/*
-	 * Touch a page in the middle of the mapping. We expect only
-	 * that page to be fetched into memory.
+	 * Touch a page in the middle of the mapping.
 	 */
 	addr[FILE_SIZE / 2] = 1;
 	retval = mincore(addr, FILE_SIZE, vec);
@@ -351,15 +348,6 @@ TEST(check_tmpfs_mmap)
 		TH_LOG("Page not found in memory after use");
 	}
 
-	i = FILE_SIZE / 2 / page_size + 1;
-	while (i < vec_size && vec[i]) {
-		ra_pages++;
-		i++;
-	}
-	ASSERT_EQ(ra_pages, 0) {
-		TH_LOG("Read-ahead pages found in memory");
-	}
-
 	munmap(addr, FILE_SIZE);
 	close(fd);
 	free(vec);

_

Patches currently in -mm which might be from [email protected] are

mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp.patch mm-huge_memory-add-folio_mark_accessed-when-zapping-file-thp-fix.patch