twx-linux/tools/testing
Qiuxu Zhuo 84b52a6cd0 selftests/mincore: Allow read-ahead pages to reach the end of the file
[ Upstream commit 197c1eaa7ba633a482ed7588eea6fd4aa57e08d4 ]

When running the mincore_selftest on a system with an XFS file system, it
failed the "check_file_mmap" test case due to the read-ahead pages reaching
the end of the file. The failure log is as below:

   RUN           global.check_file_mmap ...
  mincore_selftest.c:264:check_file_mmap:Expected i (1024) < vec_size (1024)
  mincore_selftest.c:265:check_file_mmap:Read-ahead pages reached the end of the file
  check_file_mmap: Test failed
           FAIL  global.check_file_mmap

This is because the read-ahead window size of the XFS file system on this
machine is 4 MB, which is larger than the size from the #PF address to the
end of the file. As a result, all the pages for this file are populated.

  blockdev --getra /dev/nvme0n1p5
    8192
  blockdev --getbsz /dev/nvme0n1p5
    512

This issue can be fixed by extending the current FILE_SIZE 4MB to a larger
number, but it will still fail if the read-ahead window size of the file
system is larger enough. Additionally, in the real world, read-ahead pages
reaching the end of the file can happen and is an expected behavior.
Therefore, allowing read-ahead pages to reach the end of the file is a
better choice for the "check_file_mmap" test case.

Link: https://lore.kernel.org/r/20250311080940.21413-1-qiuxu.zhuo@intel.com
Reported-by: Yi Lai <yi1.lai@intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-05-02 07:50:59 +02:00
..
crypto/chacha20-s390
cxl cxl/port: Fix use-after-free, permit out-of-order decoder shutdown 2024-11-08 16:28:24 +01:00
fault-injection
ktest ktest: Fix Test Failures Due to Missing LOG_FILE Directories 2025-04-25 10:45:20 +02:00
kunit kunit: qemu_configs: SH: Respect kunit cmdline 2025-04-25 10:45:45 +02:00
memblock
nvdimm
radix-tree test suite: use %zu to print size_t 2025-04-25 10:45:41 +02:00
scatterlist
selftests selftests/mincore: Allow read-ahead pages to reach the end of the file 2025-05-02 07:50:59 +02:00
vsock vsock/test: fix SEQPACKET message bounds test 2023-12-03 07:33:05 +01:00