Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <ljs@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Suren Baghdasaryan <surenb@google.com>,
	 Pedro Falcato <pfalcato@suse.de>,
	Matthew Wilcox <willy@infradead.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Frederick Mayle <fmayle@google.com>,
	 Kalesh Singh <kaleshsingh@google.com>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org,
	David Hildenbrand <david@kernel.org>
Subject: Re: [PATCH mm-hotfixses] Revert "mm: limit filemap_fault readahead to VMA boundaries"
Date: Mon, 22 Jun 2026 14:55:14 +0100	[thread overview]
Message-ID: <ajk-NMghY50F6Sli@lucifer> (raw)
In-Reply-To: <7ftrqtta2bw2xxtrzelrs46t7khr7tf2vmh2ur2mhdphtymlsr@rqbd3pfjxdp7>

On Mon, Jun 22, 2026 at 11:26:18AM +0200, Jan Kara wrote:
> On Fri 19-06-26 12:33:43, Suren Baghdasaryan wrote:
> > On Fri, Jun 19, 2026 at 12:26 PM Pedro Falcato <pfalcato@suse.de> wrote:
> > >
> > > On Fri, Jun 19, 2026 at 10:52:07AM -0700, Suren Baghdasaryan wrote:
> > > > On Fri, Jun 19, 2026 at 10:46 AM Matthew Wilcox <willy@infradead.org> wrote:
> > > > >
> > > > > On Fri, Jun 19, 2026 at 10:43:06AM -0700, Suren Baghdasaryan wrote:
> > > > > > > Yeah, the mmap usage on SVT-AV1 is a little suspicious, but I guess the
> > > > > > > pattern may come up time and time again for people doing chunked mmap
> > > > > > > reads. I think we need to take a closer look at this change.
> > > > > >
> > > > > > Frame-by-frame mmapping for a streaming workoad is quite questionable
> > > > > > IMHO and I don't think we should be optimizing or encouraging such
> > > > > > usage, but I understand the reasoning for the revert.
> > > > >
> > > > > If userspace is properly tuned, it doesn't need automatic readahead
> > > > > at all; it can disable it and issue manual readaheads.  The point of
> > > > > automatic readahead is to cope with userspace which is doing stupid
> > > > > things like calling read() for a single byte at a time.
> > > > >
> > > > > Could it have better defaults?  Maybe!  It's worth a try.  But those
> > > > > attempts need to have a very low bar for reversion when it turns out
> > > > > they affect other workloads.
> > > >
> > > > That what I meant in the last part of my reply :)
> > > >
> > > > But in general, I think that benchmark measuring "how many frames per
> > > > second a CPU can encode" should be revised so it doesn't depend on
> > > > file prefetching mechanisms. Otherwise it's measuring something else.
> > >
> > > To be clear, that's not (necessarily) a benchmark, the code we were
> > > looking at is their encoder app.
> >
> > Ack.
> >
> > > (it's also generally not possible to prefetch the whole thing into RAM
> > > because, well, raw video files are quite large)
> >
> > For such streaminig workload I think read() would be more appropriate,
> > and the change limiting read-ahead by VMA size would not affect it.
>
> In fact if you look at that app, it has three different methods of reading
> the input frames (mmap, normal read, fully buffered file in memory) and one
> is chosen based on config option. So the benchmark apparently configures
> the mmap method of accessing the input file.
>
> Anyway I agree with you using mmap-frame-by-frame approach for this usecase
> is kind of odd but not completely insane and it does demostrate people do
> odd things like this. For others the usecase of Android doing tons of small
> sparse mmaps into executable might look odd as well :) So this seems to be
> one of the cases where it's difficult to please everybody with the same
> behavior and we usually stick to the legacy behavior in cases like that (as
> much as I personally find restricting mmap readahead to a VMA a sensible
> thing to do). We just need to figure out how to improve the Android
> usecase.

Reading the thread, I think we're all in agreement that this is a workload
that exists and we are regressing it here, thus the revert is the right
course of action.

Andrew - could we move this to the hotfixes branch please?

>
> 								Honza
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR

Thanks, Lorenzo


  reply	other threads:[~2026-06-22 13:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 11:28 [PATCH mm-hotfixses] Revert "mm: limit filemap_fault readahead to VMA boundaries" Lorenzo Stoakes
2026-06-19 11:40 ` David Hildenbrand (Arm)
2026-06-19 11:58 ` Pedro Falcato
2026-06-19 15:47 ` Matthew Wilcox
2026-06-19 16:37 ` Andrew Morton
2026-06-19 16:52   ` Matthew Wilcox
2026-06-19 17:07     ` Lorenzo Stoakes
2026-06-19 17:08       ` Lorenzo Stoakes
2026-06-19 17:18       ` Pedro Falcato
2026-06-19 17:43         ` Suren Baghdasaryan
2026-06-19 17:46           ` Matthew Wilcox
2026-06-19 17:52             ` Suren Baghdasaryan
2026-06-19 19:26               ` Pedro Falcato
2026-06-19 19:33                 ` Suren Baghdasaryan
2026-06-22  9:26                   ` Jan Kara
2026-06-22 13:55                     ` Lorenzo Stoakes [this message]
2026-06-22 16:58                       ` Andrew Morton
2026-06-22 17:11                         ` Matthew Wilcox
2026-06-22 17:57                           ` Suren Baghdasaryan
2026-06-22 19:29                             ` Pedro Falcato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajk-NMghY50F6Sli@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=fmayle@google.com \
    --cc=jack@suse.cz \
    --cc=kaleshsingh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pfalcato@suse.de \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox