Re: [PATCH v2 1/2] mm/filemap: count only the faulting address as a mmap hit

From: Matthew Wilcox

Date: Mon Apr 27 2026 - 14:43:21 EST


On Mon, Apr 27, 2026 at 04:57:50PM +0000, fujunjie wrote:
> - /*
> - * If there are too many folios that are recently evicted
> - * in a file, they will probably continue to be evicted.
> - * In such situation, read-ahead is only a waste of IO.
> - * Don't decrease mmap_miss in this scenario to make sure
> - * we can stop read-ahead.
> - */

I'm sad to lose this comment. Why not move it to ...

> + ret |= map_ret;

here?

> + if ((map_ret & VM_FAULT_NOPAGE) &&
> + !folio_test_workingset(folio)) {
> + unsigned short mmap_miss;
> +
> + mmap_miss = READ_ONCE(file->f_ra.mmap_miss);
> + if (mmap_miss)
> + WRITE_ONCE(file->f_ra.mmap_miss,
> + mmap_miss - 1);
> + }