Skip to content

mm/huge_memory: optimize migration when huge PMD needs split

Wei Yang linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/huge_memory: return true if split_huge_pmd_locked() split PMD to migration entryinclude/linux/huge_mm.h mm/huge_memory.c mm/rmap.c+27 -149 replies
2/2mm/selftests: add split_shared_pmd()tools/testing/selftests/mm/split_huge_page_test.c+72 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] mm/huge_memory: optimize migration when huge PMD needs split

This is a follow up optimization for commit 939080834fef ("mm/huge_memory:
fix early failure try_to_migrate() when split huge pmd for shared THP").

When split_huge_pmd_locked() successfully split the PMD entry with @freeze = true, it means each PTE entry are properly set to migration entry. And we can return from try_to_migrate_one() directly.

Currently it is done in a sub-optimal way: it always restarts the walk and go through each PTE entry by page_vma_mapped_walk() which then skip all of them when the PMD is split to migration entry.

Let split_huge_pmd_locked() indicate whether it split PMD to migration entry, so that to optimize migration if huge PMD needs split.

Also add a selftest to check the bug fixed in commit 939080834fef ("mm/huge_memory: fix early failure try_to_migrate() when split huge pmd for shared THP") will not be introduced.

Cc Gavin Guo <[email protected]>
Cc "David Hildenbrand (Red Hat)" <[email protected]>
Cc Zi Yan <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Lance Yang <[email protected]>

Wei Yang (2):
mm/huge_memory: return true if split_huge_pmd_locked() split PMD to
migration entry
mm/selftests: add split_shared_pmd()

 include/linux/huge_mm.h                       |  9 ++-
 mm/huge_memory.c                              | 21 ++++--
 mm/rmap.c                                     | 11 ++-
 .../selftests/mm/split_huge_page_test.c       | 73 ++++++++++++++++++-
 4 files changed, 99 insertions(+), 15 deletions(-)
Signature · 1 line
2.34.1