Skip to content

RFC mm/huge_memory: refactor __split_huge_pmd_locked()

Yin Tirui linux-mm lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest9 patches 0 repliesNew
  2. v1 RFC9 patches 3 repliesSuperseded

Changes in v2 from the cover letter

https://lore.kernel.org/linux-mm/[email protected]/#t
- Rebase onto mainline.
- Use !vma_is_mm_managed() in place of vma_is_special_huge() in patch 3.
- Use vma_has_deposited_pgtable() in patch 4, following Lance Yang's pgtable deposit cleanup.
https://lore.kernel.org/linux-mm/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9mm/huge_memory: read the huge PMD entry once when splitting itmm/huge_memory.c+8 -80 replies
2/9mm/huge_memory: add and use huge_zero_pmd_can_split()mm/huge_memory.c+23 -130 replies
3/9mm/huge_memory: add and use unmap_huge_pmd_entry()mm/huge_memory.c+56 -280 replies
4/9mm/huge_memory: use normal_or_softleaf_folio_pmd() in the PMD split pathmm/huge_memory.c+12 -90 replies
5/9mm/huge_memory: dispatch on the folio when splitting a huge PMDmm/huge_memory.c+2 -70 replies
6/9mm/huge_memory: add and use split_huge_pmd_anon_rmap()mm/huge_memory.c+47 -430 replies
7/9mm/huge_memory: add struct split_pmd_statemm/huge_memory.c+88 -720 replies
8/9mm/huge_memory: split present and non-present huge PMDs separatelymm/huge_memory.c+180 -1540 replies
9/9mm/huge_memory: unify the migration and device private PTE loopsmm/huge_memory.c+43 -460 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH RFC v2 0/9] mm/huge_memory: refactor __split_huge_pmd_locked()

__split_huge_pmd_locked() currently decides from the VMA -- vma_is_anonymous(), then vma_is_special_huge() (now replaced by !vma_is_mm_managed()) -- before inspecting the PMD entry, so split and zap use different classification logic. The entry itself should decide. The function also mixes the present and non-present cases, resulting in duplicated code.

This series uses the PMD entry and its folio to decide how to handle each PMD, as zap_huge_pmd() does. It separates the present and non-present paths and moves their common work into helper functions. After this change, __split_huge_pmd_locked() only selects the appropriate helper.

v1 -> v2:
https://lore.kernel.org/linux-mm/[email protected]/#t
- Rebase onto mainline.
- Use !vma_is_mm_managed() in place of vma_is_special_huge() in patch 3.
- Use vma_has_deposited_pgtable() in patch 4, following Lance Yang's pgtable deposit cleanup.
https://lore.kernel.org/linux-mm/[email protected]/

Yin Tirui (9):
mm/huge_memory: read the huge PMD entry once when splitting it mm/huge_memory: add and use huge_zero_pmd_can_split() mm/huge_memory: add and use unmap_huge_pmd_entry() mm/huge_memory: use normal_or_softleaf_folio_pmd() in the PMD split
path
mm/huge_memory: dispatch on the folio when splitting a huge PMD mm/huge_memory: add and use split_huge_pmd_anon_rmap() mm/huge_memory: add struct split_pmd_state mm/huge_memory: split present and non-present huge PMDs separately mm/huge_memory: unify the migration and device private PTE loops

 mm/huge_memory.c | 525 +++++++++++++++++++++++++++--------------------
 1 file changed, 302 insertions(+), 223 deletions(-)
Signature · 1 line
2.34.1