Kernel THP split path split into anon and file helpers
Kairui Song’s cleanup series separates mixed folio-split logic so swap-cache restrictions can be lifted later.
Kairui Song has landed a cleanup of the Linux kernel’s transparent huge page (THP) split path that separates anonymous and file-backed folio handling, work Andrew Morton has already queued in the mm tree.
Until now a single routine mixed anonymous, page-cache, and swap-cache folios. That entanglement left dead checks in place and made it hard to review or relax the rules that still limit how swap-cache huge pages can be split. The series factors the path into dedicated anon and file helpers, keeps all swap-cache logic on the anon side, and rejects swap-cache folios before they reach the file helper.
Beyond two small bug fixes and a narrow change to when unmapped anonymous THPs (including fully swapped-out pages still in the swap cache) may split instead of failing busy, the work is structural. Remapping after unmap is now clearly anon-only, reference counting for freeze/unfreeze is named for what it actually counts, and after-split swap-cache freeing is made deterministic under the folio lock.
Song reports the in-tree split selftest still passes fully, with slightly lower per-call latency under ftrace. Reviewers including Zi Yan, Kiryl Shutsemau, Yeoreum Yun, and David Hildenbrand backed the series. The practical payoff is maintainability: a cleaner base for lifting the remaining swap-cache split limits without fighting a mixed code path.