Skip to content

Optimize folio split in memory failure

Zi Yan linux-fsdevel linux-mm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 5 repliesIn review 2 of 3 applied
  2. v4 posting 2/23 patches 17 repliesSuperseded
  3. v4 posting 1/21 patch 11 repliesApplied 1/1
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v34 patches14 repliesSuperseded

Patches in v5 2 of 3 applied

#Subject and filesSizeRepliesApplied
1/3mm/huge_memory: add split_huge_page_to_order()include/linux/huge_mm.h+10 -20 repliesApplied
2/3mm/memory-failure: improve large block size folio handling.mm/memory-failure.c+27 -40 repliesApplied
3/3mm/huge_memory: fix kernel-doc comments for folio_split() and related.include/linux/huge_mm.h mm/huge_memory.c+30 -255 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchLuis ChamberlainLorenzo StoakesDavid HildenbrandWei YangMiaohe LinBarry SongLance YangDavid Hildenbrand (Red Hat)
1/3R-b A-b R-b R-b R-b R-b
2/3R-b R-b A-b R-b R-b R-b R-b
3/3R-b R-b R-b R-b R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/3] Optimize folio split in memory failure

This patchset optimizes folio split operations in memory failure code by always splitting a folio to min_order_for_split() to minimize unusable pages, even if min_order_for_split() is non zero and memory failure code would take the failed path eventually for a successfully split folio. This means instead of making the entire original folio unusable memory failure code would only make its after-split folio, which has order of min_order_for_split() and contains HWPoison page, unusable. For soft offline case, since the original folio is still accessible, no split is performed if the folio cannot be split to order-0 to prevent potential performance loss. In addition, add split_huge_page_to_order() to improve code readability and fix kernel-doc comment format for folio_split() and other related functions.

It is based on mm-new without V4 of this patchset.

Background
===

This patchset is a follow-up of "[PATCH v3] mm/huge_memory: do not change split_huge_page*() target order silently."[1] and
[PATCH v4] mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order[2], since both are separated out as hotfixes. It improves how memory failure code handles large block size(LBS) folios with min_order_for_split() > 0. By splitting a large folio containing HW poisoned pages to min_order_for_split(), the after-split folios without HW poisoned pages could be freed for reuse. To achieve this, folio split code needs to set has_hwpoisoned on after-split folios containing HW poisoned pages and it is done in the hotfix in [2].

This patchset includes:
1. A patch adds split_huge_page_to_order(),
2. Patch 2 and Patch 3 of "[PATCH v2 0/3] Do not change split folio target order"[3],

Changelog
===
From V4[5]:
1. updated cover letter.
2. updated __split_unmapped_folio() comment and removed stale text.

From V3[4]:
1. Patch, mm/huge_memory: preserve PG_has_hwpoisoned if a folio is split to >0 order, is sent separately as a hotfix[2].
2. made newly added new_order const in memory_failure() and soft_offline_in_use_page().
3. explained in a comment why in memory_failure() after-split >0 order folios are still treated as if the split failed.

From V2[3]:
1. Patch 1 is sent separately as a hotfix[1].
2. set has_hwpoisoned on after-split folios if any contains HW poisoned pages.
3. added split_huge_page_to_order().
4. added a missing newline after variable decalaration.
5. added /* release= */ to try_to_split_thp_page().
6. restructured try_to_split_thp_page() in memory_failure().
7. fixed a typo.
8. reworded the comment in soft_offline_in_use_page() for better understanding.

Zi Yan (3):
mm/huge_memory: add split_huge_page_to_order() mm/memory-failure: improve large block size folio handling. mm/huge_memory: fix kernel-doc comments for folio_split() and related.

 include/linux/huge_mm.h | 22 ++++++++++++++------
 mm/huge_memory.c        | 45 ++++++++++++++++++++++-------------------
 mm/memory-failure.c     | 31 ++++++++++++++++++++++++----
 3 files changed, 67 insertions(+), 31 deletions(-)
Signature · 1 line
2.51.0