[PATCH mm-new 0/2] mm/khugepaged: refactor and merge PTE scanning logic

From: Lance Yang
Date: Thu Oct 02 2025 - 03:35:20 EST


Hi all,

This series cleans up the almost-duplicated PTE scanning logic in the
collapse path.

The first one is a preparatory step that refactors both loops to use
a single if-else-if-else-if chain for checking disjoint PTEs.

The second one then extracts the common logic into a shared helper.

Thanks,
Lance

Lance Yang (2):
mm/khugepaged: optimize PTE scanning with if-else-if-else-if chain
mm/khugepaged: merge PTE scanning logic into a new helper

mm/khugepaged.c | 171 +++++++++++++++++++++++++++++-------------------
1 file changed, 104 insertions(+), 67 deletions(-)

--
2.49.0