Re: [PATCH v3 2/3] mm: move folio LRU code out of swap

From: Jianyue Wu

Date: Wed Jun 03 2026 - 08:35:39 EST


On Wed, Jun 3, 2026 at 8:03 PM Lorenzo Stoakes <ljs@xxxxxxxxxx> wrote:
>
> On Wed, Jun 03, 2026 at 06:49:16PM +0800, Baoquan He wrote:
> > On 06/02/26 at 04:57pm, Matthew Wilcox wrote:
> > > On Tue, Jun 02, 2026 at 09:01:16AM +0800, Jianyue Wu wrote:
> > > > Rename mm/swap.c to mm/folio_lru.c so the filename better matches
> > > > the code's main responsibility.
> > > >
> > > > This keeps the implementation split from swap-specific code without
> > > > changing the published LRU helper interfaces.
> > >
> > > At the same time, we have Tal trying to split folio_wait.c out
> > > of filemap.c. https://lore.kernel.org/linux-mm/20260520-filemap-split-v1-0-c36ddc2b6cf2@xxxxxxxxxxxx/
> > >
> > > I wonder if instead of folio_lru.c and folio_wait.c, we shouldn't simply
> > > have folio.c. Tal has 700 lines in his diffstat, you'll have about 1100
> > > lines, so that's about 1800 llines which seems like a good size.
> > > There's some functions from mm/util.c that would fit nicely too --
> > > folio_mapping(), folio_anon_vma(), folio_copy(), flush_dcache_folio()
> >
> > I think folio_lru.c and folio_wait.c are better than a single folio.c.
> >
> > A single folio.c with all of them would have no clear boundary for what
> > belongs there and what doesn't. For comparison, page_alloc.c isn't called
> > page.c (we have files called mm/page*.c).
>
> Well page_alloc.c doesn't only contain things that operate on struct page *
> right?
>
> Whereas folio.c is strictly operations literally performed on folios which seems
> like a good match to me.
>
> I find folio_lru.c and folio_wait.c far more difficult to figure out what goes
> where and there'll be a bunch of miscellaneous stuff all over the place.
>
> I vote for folio.c.
>
> >
> > >
> > > Other people have thoughts?
> > >
>
> Thanks, Lorenzo

Thanks Matthew, Baoquan and Lorenzo for the naming discussion.

I'm posting v4 shortly. It keeps the rename to mm/folio_lru.c so this
series stays a small cleanup on top of the swap_ops work. A broader
mm/folio.c (together with Tal's folio_wait split and the util.c
helpers Matthew mentioned) will be a separate follow-up
once there is maintainer consensus on the file boundaries.

Happy to help on that follow-up.

Thanks,
Best regards,
Jianyue