Re: [PATCH] readahead: fix return value of page_cache_next_miss() when no hole is found

From: Chi Zhiling
Date: Sat Jun 07 2025 - 23:01:00 EST


On 2025/6/6 18:54, Jan Kara wrote:
On Thu 05-06-25 14:51:52, Andrew Morton wrote:
On Thu, 5 Jun 2025 10:22:23 +0200 Jan Kara <jack@xxxxxxx> wrote:

On Thu 05-06-25 13:49:35, Chi Zhiling wrote:
From: Chi Zhiling <chizhiling@xxxxxxxxxx>

max_scan in page_cache_next_miss always decreases to zero when no hole
is found, causing the return value to be index + 0.

Fix this by preserving the max_scan value throughout the loop.

Fixes: 901a269ff3d5 ("filemap: fix page_cache_next_miss() when no hole found")
Signed-off-by: Chi Zhiling <chizhiling@xxxxxxxxxx>

Indeed. Thanks for catching this. Don't know how I missed that. Feel free
to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Thanks



Thanks. It's a simple patch - do we expect it to have significant
runtime effects?

I'm not sure if Chi Zhiling observed some practical effects. From what I
know and have seen in the past, wrong responses from page_cache_next_miss()
can lead to readahead window reduction and thus reduced read speeds.

Honza

TBH, in my simple sequential reading test, I did not see any significant speed improvement.