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

Lance Yang posted 3 patches 1 month, 1 week ago
mm/khugepaged.c | 243 ++++++++++++++++++++++++++----------------------
1 file changed, 131 insertions(+), 112 deletions(-)
[PATCH mm-new v2 0/3] mm/khugepaged: refactor and merge PTE scanning logic
Posted by Lance Yang 1 month, 1 week ago
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 replaces VM_BUG_ON_FOLIO() with a more graceful
VM_WARN_ON_FOLIO() for handling non-anonymous folios.

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

Thanks,
Lance

---
v1 -> v2:
- #01 Update the changelog (per Dev)
- #01 Collect Reviewed-by from Wei, Dev and Zi - thanks!
- #03 Make more of the scanning logic common between scan_pmd() and
      _isolate() (per Dev)
- https://lore.kernel.org/linux-mm/20251002073255.14867-1-lance.yang@linux.dev

Lance Yang (3):
  mm/khugepaged: optimize PTE scanning with if-else-if-else-if chain
  mm/khugepaged: use VM_WARN_ON_FOLIO instead of VM_BUG_ON_FOLIO for
    non-anon folios
  mm/khugepaged: merge PTE scanning logic into a new helper

 mm/khugepaged.c | 243 ++++++++++++++++++++++++++----------------------
 1 file changed, 131 insertions(+), 112 deletions(-)

-- 
2.49.0