Re: [PATCH v2 1/2] mm/filemap: count only the faulting address as a mmap hit
From: Fujunjie
Date: Mon Apr 27 2026 - 21:14:47 EST
On Tue, Apr 28, 2026 at 02:40, Matthew Wilcox wrote:
> 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);
>> + }
Yes, that makes sense. I'll move the comment there in the next version.
Best regards,
fujunjie