[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSDEU_C5QaSXD18x@casper.infradead.org>
Date: Fri, 21 Nov 2025 19:58:11 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Jaegeuk Kim <jaegeuk@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH] [RFC] mm/fadvise: introduce POSIX_FADV_MLOCK
On Fri, Nov 21, 2025 at 07:52:02PM +0000, Jaegeuk Kim wrote:
> On 11/21, Jaegeuk Kim wrote:
> > On 11/21, Matthew Wilcox wrote:
> > > On Fri, Nov 21, 2025 at 04:46:14AM +0000, Jaegeuk Kim wrote:
> > > > On 11/21, Matthew Wilcox wrote:
> > > > > On Fri, Nov 21, 2025 at 03:27:18AM +0000, Jaegeuk Kim wrote:
> > > > > > This patch introduces a new POSIX_FADV_MLOCK which 1) invalidates the range of
> > > > > > cached pages, 2) sets the mapping as inaccessible, 3) POSIX_FADV_WILLNEED loads
> > > > > > pages directly to the inaccessible mapping.
> > > > >
> > > > > ... what?
> > > > >
> > > > > This seems like something which is completely different from mlock().
> > > > > So it needs a different name.
> > > > >
> > > > > But I don't understand the point of this, whatever it's called. Need
> > > > > more information.
> > > >
> > > > So, the sequence that I'd like to optimize is mmap(MAP_POPULATE) followed
> > > > by mlock(). For example, mmap() takes 1 second to load 4GB data, and mlock()
> > > > takes 330ms additionally in order to migrate all the pages into inaccessible
> > > > map, IIUC.
> > >
> > > Oh, so the MLOCK part is right, but the inaccessible() part is wrong.
> > > Inaccessible is special weird guest_memfd crap that has all kinds of
> > > side-effects that you don't want.
> > >
> > > Wouldn't you get the same effect by calling mlock2(MLOCK_ONFAULT) and
> > > then calling readahead() for the desired range?
> >
> > Oh, thank you. Let me try.
>
> After checking the code and experiment, I don't think that gives what we need.
> That flag skips populate_vma_page_range only, but we need to allocate pages
> in the inaccessible mapping and fill the pages afterwards.
Then either I don't understand what you're trying to do, or you don't
understand what the inaccessible mapping is for. Is this just for
speeding up mlock() as you suggested earlier, or are you genuinely
trying to do something with the inaccessible mapping?
Powered by blists - more mailing lists