On Fri,  3 Jul 2026 20:52:53 +0800 "Yijia Wang" <[email protected]> 
wrote:

> check_file_mmap faults a page in the middle of a file mapping and
> expects the readahead window to have populated further pages *after*
> it. With a large base page size this is wrong and the test fails
> reliably, e.g. on arm64 with 64K pages:
> 
>   # mincore_selftest.c:260:check_file_mmap:Expected ra_pages (0) > 0 (0)
>   # mincore_selftest.c:261:check_file_mmap:No read-ahead pages found in memory
>   not ok 4 global.check_file_mmap

I'm not sure this is a good thing for us to be self-testing for.  It's
poking pretty deeply inside the internal implementations of
kernel-of-the-moment.

Oh well, I guss if the test suddenly starts reporting errors, it might
be something we want to look into.

> The read-around window is read_ahead_kb / page_size pages wide and is
> centred on the faulting page (mm/filemap.c):
> 
>   ra->start = max(0, pgoff - ra_pages / 2)
> 
> With the default 128K budget that is 32 pages on 4K but only 2 pages on
> 64K, so the window becomes [pgoff-1, pgoff] and the single extra page
> lands *before* the faulted page. The forward-only scan finds nothing.
> This is not a huge-page (THP) effect; it is just a byte-sized readahead
> budget divided by a large page size plus a fault-centred window.
> 
> Count readahead pages on both sides of the faulted page, and skip the
> readahead check up front when there is no usable read-around window:
> either it is narrower than two pages (readahead disabled, or the base
> page size so large that read_ahead_kb covers a single page), or the file
> has no backing block device whose read_ahead_kb can be read (e.g. on
> tmpfs). When the window is wide enough the EXPECT_GT(ra_pages, 0)
> assertion is kept, so a kernel that should read ahead but does not is
> still caught.

Thanks.  AI review might have found a couple of things of interest:
        
https://sashiko.dev/#/patchset/[email protected]



Reply via email to