Re: [PATCH] mm: limit filemap_fault readahead to VMA boundaries
From: Frederick Mayle
Date: Thu Apr 23 2026 - 18:48:53 EST
On Wed, Apr 22, 2026 at 5:56 AM Jan Kara <jack@xxxxxxx> wrote:
>
> On Wed 22-04-26 13:30:47, Matthew Wilcox wrote:
> > The problem is that we might (for example) use mprotect() to mark a
> > portion of the file as being unmodifiable, but nevertheless still want
> > to prefetch through it (since it will be read, just not written). I'm
> > sure this solves your problem, but I'm not sure it covers all use cases.
>
> Well, I'm not sure whether all the usecases are covered either but is what
> you describe above something you'd expect people to commonly do? In general
> sequential reading through mmap seems to be already relatively rare...
I'm curious if anyone knows of a use case like this. I'd think that, if a user
is making heavy usage of mprotect, they'd be advance enough to be a step away
(or a few steps beyond) wanting to manually trigger readahead with madvise or
similar.
In recent history, commit 38b0ece6d763 ("mm/filemap: allow arch to request
folio size for exec memory") disabled readahead for VM_EXEC mappings and there
doesn't seem to have been pushback yet. Of course, non-exec mappings almost
certainly have more varied uses.