freenode
Kernel & Low-Level

Meta's 57-patch THP collapse rewrite meets kernel pushback

A migration-based engine aimed at mTHP on large base pages is told to land smaller foundations first, while AI-polished list replies draw separate fire.

Kiryl Shutsemau of Meta has posted a 57-patch RFC that would replace khugepaged's anonymous transparent huge page collapse with a new engine built on migration entries and frozen folios, able to collapse sub-PMD ranges. Memory management reviewers told him not to drive the full series as-is and to land smaller foundation work first.

The practical driver is Meta's arm64 fleet with 64K base pages, where a PMD spans 512MB. PMD-order THP is of limited use at that size; multi-size THP (mTHP) is what those systems need. mTHP collapse did land in khugepaged, but the path still only considers PMD-aligned windows and assumes PMD granularity end to end: it clears and flushes whole PMDs, can only install PMD leaves, and keeps concurrent activity out with mmap and anon_vma write locks plus an IPI broadcast. That model is safe only when one VMA owns the entire PMD, which is the restriction that blocks useful mTHP collapse on large-base-page architectures.

Shutsemau's design freezes the source pages themselves behind migration barriers instead of holding the address space still, aiming for better scalability and less disruption to the workload being collapsed. He presents the end state as a clean cutover: the new engine beside the old path, then a switch of the anonymous path and removal of the code it replaces, with no correct halfway state between the two serialization models.

Lorenzo Stoakes (ARM) objected to the shape, writing "Please don't respin this as a 57 patch series" and pointing at smaller foundational series as the right pattern. David Hildenbrand questioned the churn, whether the work was a cleanup in disguise that would leave the code harder to maintain, and how it would sit beside proposed file and shmem mTHP collapse. Stoakes asked for an explicit commitment to a relatively small, no-functional-change series that improves THP code and lays foundations, after the merge window. Shutsemau acked.

Separately, Hildenbrand asked whether Shutsemau was using AI for mailing-list replies, saying they did not read like his usual writing "in a bad way." Shutsemau said he used it to check claims and fix grammar. Both Hildenbrand and Stoakes urged him to keep his own voice and write replies himself, arguing the polished volume was adding review load on top of an already large proposal.