mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file
@ 2025-03-11  8:09 Qiuxu Zhuo
  2025-04-08  2:42 ` Zhuo, Qiuxu
  0 siblings, 1 reply; 4+ messages in thread
From: Qiuxu Zhuo @ 2025-03-11  8:09 UTC (permalink / raw)
  To: shuah; +Cc: linux-kselftest, linux-kernel, qiuxu.zhuo, yi1.lai

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.

Reported-by: Yi Lai <yi1.lai@intel.com>
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 tools/testing/selftests/mincore/mincore_selftest.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/testing/selftests/mincore/mincore_selftest.c b/tools/testing/selftests/mincore/mincore_selftest.c
index e949a43a6145..efabfcbe0b49 100644
--- a/tools/testing/selftests/mincore/mincore_selftest.c
+++ b/tools/testing/selftests/mincore/mincore_selftest.c
@@ -261,9 +261,6 @@ TEST(check_file_mmap)
 		TH_LOG("No read-ahead pages found in memory");
 	}
 
-	EXPECT_LT(i, vec_size) {
-		TH_LOG("Read-ahead pages reached the end of the file");
-	}
 	/*
 	 * End of the readahead window. The rest of the pages shouldn't
 	 * be in memory.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file
  2025-03-11  8:09 [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file Qiuxu Zhuo
@ 2025-04-08  2:42 ` Zhuo, Qiuxu
  2025-04-08 23:11   ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Zhuo, Qiuxu @ 2025-04-08  2:42 UTC (permalink / raw)
  To: shuah; +Cc: linux-kselftest, linux-kernel, Lai, Yi1

Hi Shuah Khan,

Just a gentle ping regarding this patch. 
If you have any questions, please feel free to let me know. 

Thanks! 
-Qiuxu

> From: Zhuo, Qiuxu <qiuxu.zhuo@intel.com>
> [...]
> Subject: [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the
> end of the file
> 
> 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.
> 
> Reported-by: Yi Lai <yi1.lai@intel.com>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
> ---
>  tools/testing/selftests/mincore/mincore_selftest.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/mincore/mincore_selftest.c
> b/tools/testing/selftests/mincore/mincore_selftest.c
> index e949a43a6145..efabfcbe0b49 100644
> --- a/tools/testing/selftests/mincore/mincore_selftest.c
> +++ b/tools/testing/selftests/mincore/mincore_selftest.c
> @@ -261,9 +261,6 @@ TEST(check_file_mmap)
>  		TH_LOG("No read-ahead pages found in memory");
>  	}
> 
> -	EXPECT_LT(i, vec_size) {
> -		TH_LOG("Read-ahead pages reached the end of the file");
> -	}
>  	/*
>  	 * End of the readahead window. The rest of the pages shouldn't
>  	 * be in memory.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file
  2025-04-08  2:42 ` Zhuo, Qiuxu
@ 2025-04-08 23:11   ` Shuah Khan
  2025-04-09  2:44     ` Zhuo, Qiuxu
  0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2025-04-08 23:11 UTC (permalink / raw)
  To: Zhuo, Qiuxu, shuah; +Cc: linux-kselftest, linux-kernel, Lai, Yi1, Shuah Khan

On 4/7/25 20:42, Zhuo, Qiuxu wrote:
> Hi Shuah Khan,
> 
> Just a gentle ping regarding this patch.
> If you have any questions, please feel free to let me know.
> 
> Thanks!
> -Qiuxu
> 
>> From: Zhuo, Qiuxu <qiuxu.zhuo@intel.com>
>> [...]
>> Subject: [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the
>> end of the file
>>
>> 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.
>>
>> Reported-by: Yi Lai <yi1.lai@intel.com>
>> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
>> ---

Applied for Linux 6.15-rc2

https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=fixes

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file
  2025-04-08 23:11   ` Shuah Khan
@ 2025-04-09  2:44     ` Zhuo, Qiuxu
  0 siblings, 0 replies; 4+ messages in thread
From: Zhuo, Qiuxu @ 2025-04-09  2:44 UTC (permalink / raw)
  To: Shuah Khan, shuah; +Cc: linux-kselftest, linux-kernel, Lai, Yi1

> From: Shuah Khan <skhan@linuxfoundation.org>
> [...]
> 
> Applied for Linux 6.15-rc2
> 
> https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-
> kselftest.git/log/?h=fixes

Thanks for reviewing and considering this fix.

-Qiuxu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-09  2:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11  8:09 [PATCH 1/1] selftests/mincore: Allow read-ahead pages to reach the end of the file Qiuxu Zhuo
2025-04-08  2:42 ` Zhuo, Qiuxu
2025-04-08 23:11   ` Shuah Khan
2025-04-09  2:44     ` Zhuo, Qiuxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®