Re: [PATCH v3 04/18] mm/huge_memory: split the routine for splitting anon and file folio

From: Zi Yan

Date: Tue Aug 25 2026 - 21:34:15 EST


On Thu Aug 20, 2026 at 2:55 PM EDT, Kairui Song via B4 Relay wrote:
> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> No functional change intended. Before adding more logic, split
> __folio_freeze_and_split_unmapped() into an anon and a file variant so
> each path can evolve independently. The two paths shared little beyond
> the folio freeze call, the LRU locking, and the unfreeze skeleton, but
> differed in all other per-folio bookkeeping and routines.
>
> While splitting, some cleanups become easy to apply, and helped drop a
> few now-redundant checks. Also introduce a folio iteration helper to
> avoid a common pitfall of iterating post-split sub-folios: a sub folio
> might get freed mid-iteration as pointed out by Zi [1].
>
> Link: https://lore.kernel.org/linux-mm/DKJSFCLP967N.YBR4DNK1NM2N@xxxxxxxxxx/ [1]
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> ---
> mm/huge_memory.c | 119 +++++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 75 insertions(+), 44 deletions(-)
>

LGTM.

Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>



--
Best Regards,
Yan, Zi