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

From: Nico Pache

Date: Mon Jul 20 2026 - 11:32:25 EST


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

Cheers,
-- Nico

>
> Based on top of latest mm-unstable.
>
> Cc: Zi Yan <ziy@xxxxxxxxxx>
> Cc: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Cc: "Liam R. Howlett" <liam@xxxxxxxxxxxxx>
> Cc: Nico Pache <npache@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Dev Jain <dev.jain@xxxxxxx>
> Cc: Barry Song <baohua@xxxxxxxxxx>
> Cc: Lance Yang <lance.yang@xxxxxxxxx>
> Cc: Usama Arif <usama.arif@xxxxxxxxx>
> Cc: linux-mm@xxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Pedro Falcato (8):
> mm/khugepaged: separate out windy folio logic from collapse_file
> mm/khugepaged: factor out page cache folio reading
> mm/khugepaged: factor out and simplify dirty/writeback handling
> mm/khugepaged: simplify prepare folio locking and exit paths
> mm/khugepaged: add kerneldoc to prepare_collapse_file_folio()
> mm/khugepaged: hoist isolation into collapse_isolate_folio()
> mm/khugepaged: hoist more code into collapse_isolate_folio()
> mm/khugepaged: fix and flesh out try_to_unmap_flush() comment
>
> mm/khugepaged.c | 424 ++++++++++++++++++++++++++++--------------------
> 1 file changed, 248 insertions(+), 176 deletions(-)
>
> --
> 2.55.0
>