Re: [PATCH] mm: make mmap_miss accounting symmetric for VM_SEQ_READ
From: Usama Arif
Date: Mon May 25 2026 - 11:05:56 EST
On 25/05/2026 15:57, Usama Arif wrote:
> do_sync_mmap_readahead() skips both the mmap_miss increment and the
> MMAP_LOTSAMISS check for VM_SEQ_READ mappings, since sequential access
> is non-speculative and should always read ahead. The two decrement
> sites in do_async_mmap_readahead() and filemap_map_pages() do not
> mirror this skip, so concurrent faults on a VM_SEQ_READ mapping can
> still drive ra->mmap_miss down to zero through the decrement paths
> even though nothing in the sync path ever increments it. The counter
> itself is per-file (file->f_ra.mmap_miss), so it can be moved by any
> VMA mapping the file, not just the one currently faulting.
>
> Skip the decrement for VM_SEQ_READ in both decrement sites so the
> counter only moves for mappings that also participate in the
> increment side. No functional change for VM_SEQ_READ users, since the
> increment-side gate already prevents the counter from being consulted
> on their behalf, but it stops a VM_SEQ_READ mapping from biasing the
> counter for other mappings of the same file.
>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
The patch is a result of review from sashiko on another one of my patches:
https://lore.kernel.org/all/8edc8cd0-f65c-4456-9b3f-362e744c9a96@xxxxxxxxx/