[PATCH v7 1/2] mm: bypass mmap_miss heuristic for VM_EXEC readahead

Oscar Salvador (SUSE) osalvador at kernel.org
Mon Jun 1 20:51:03 PDT 2026


On Mon, Jun 01, 2026 at 03:21:17AM -0700, Usama Arif wrote:
> The mmap_miss heuristic is intended to stop speculative mmap readahead
> when a file looks like a random-access workload. That does not fit the
> VM_EXEC path very well.
> 
> VM_EXEC readahead is already constrained differently from ordinary mmap
> read-around: it is bounded by the VMA, uses exec_folio_order() to choose
> an order useful for executable mappings, and sets async_size to 0 so it
> does not create follow-on readahead. When VM_HUGEPAGE is also present,
> the larger readahead is an explicit userspace opt-in.
> 
> The mmap_miss counter is decremented from cache-hit paths in
> do_async_mmap_readahead() and filemap_map_pages(). Those paths are not
> always enough to balance the synchronous miss increments for executable
> mappings. In particular, when fault-around is effectively disabled, such
> as configurations where fault_around_pages is 1, filemap_map_pages() is
> not reached from the fault path. The counter can then become a stale
> throttle for VM_EXEC mappings and suppress the readahead behavior that
> the executable-specific path is trying to provide.
> 
> Skip both mmap_miss increments and decrements for VM_EXEC mappings,
> matching the existing VM_SEQ_READ treatment and keeping the counter
> accounting symmetric.
> 
> Signed-off-by: Usama Arif <usama.arif at linux.dev>
> Reviewed-by: Jan Kara <jack at suse.cz>
> Reviewed-by: Kiryl Shutsemau (Meta) <kas at kernel.org>

Reviewed-by: Oscar Salvador (SUSE) <osalvador at kernel.org>


-- 
Oscar Salvador
SUSE Labs



More information about the linux-arm-kernel mailing list