Re: [PATCH 0/8] mm/khugepaged: collapse_file() cleanups

From: Nico Pache

Date: Tue Jul 21 2026 - 04:30:19 EST


On Tue, Jul 21, 2026 at 1:55 AM Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx> wrote:
>
> On Mon, Jul 20, 2026 at 02:14:45PM -0600, Nico Pache wrote:
> > On Mon, Jul 20, 2026 at 1:49 PM Pedro Falcato <pfalcato@xxxxxxx> wrote:
> > >
> > > On Mon, Jul 20, 2026 at 09:21:11AM -0600, Nico Pache wrote:
> > > > On Mon, Jul 20, 2026 at 8:33 AM Pedro Falcato <pfalcato@xxxxxxx> wrote:
> > > > >
> > > > > Here are a bunch of cleanups for collapse_file() that attempt to aid
> > > > > code readability and understanding. This is part 1 out of N, and only
> > > > > attempts to address the main collapse loop. The exit path is still a
> > > > > mess but I figure it's much easier to review if I send this batch as-is,
> > > > > versus sending the whole thing.
> > > >
> > > > Hi Pedro,
> > > >
> > > > I have already prepped a cleanup series for collapse_file().
> > > >
> > > > I was waiting for my work here
> > > > https://lore.kernel.org/lkml/20260715025941.1571316-1-npache@xxxxxxxxxx/
> > > > to be reviewed (and in mm-unstable) before sending it out.
> > > >
> > > > Our series have several similarities; for reference, here is my version.
> > > > https://gitlab.com/npache/linux/-/commits/khugepaged_file_refactor?ref_type=heads
> > >
> > > Ugh, this is awkward. Do you have any suggestions on next steps?
> >
> > Let me review your series and see what differences stand out. You
> > referenced part 1 of N; I think my series covers many of the other
> > parts. I basically broke down each stage of collapse_file() into
> > helpers, and cleaned up each part respectively.
> >
> > Whatever we decide, as long as collapse_file() gets the proper love im
> > ok with it. I did, however, communicate that I was cleaning this up to
> > David, Lorenzo, and others.
>
> Yeah I'm keen that we find a good compromise here, as I genuinely very much
> empathise with both sides of this - being 'pipped' on a series is horrible and
> we generally really want to avoid that.
>
> But I hope that some collaborative effort is possible here?

Yes definitely! Pedro's series covers only part of what my work
addresses. I think it will be pretty easy to take his work, and my
commits for the rest of the collapse_file() function.

>
> >
> > >
> > > I can try and take in some of your work on top of this series. But that might
> > > be hairy.
> > >
> > > This situation really does suck (I've definitely been there), but I would
> > > prefer not to drop the patchset.
> >
> > Yeah that might be hard. However, there are other parts I cleaned up
> > that you haven't touched in this series so perhaps some of those apply
> > cleanly.
>
> It'd be ideal if you guys could figure out a way to combine both in a series,
> perhaps with Co-Dev-By or similar?

I've reached out to him to coordinate this effort :)

Thanks,
-- Nico

>
> >
> > Cheers,
> > -- Nico
> >
> > >
> > > --
> > > Pedro
> > >
> >
>
> I'll leave it to you two to figure things out, I've left some review here
> already (the general thrust of the series is good and cleaning
> this... 'organically grown' code is a wonderful thing), but will pause until you
> figure out a way forwards.
>
> Cheers, Lorenzo
>