A few fixup and cleanup patches for memory failure
Subsystems (2)
Miaohe Lin
maintainerv2 cover A few fixup and cleanup patches for memory failure
Hi everyone,
This series contains a patch to clean up the HWPoisonHandlable and another one to dissolve truncated hugetlb page. More details can be found in the respective changelogs. Thanks!
---
v2:
drop patch "mm/memory-failure.c: avoid false-postive PageSwapCache test" collect Reviewed-by and Acked-by tag.
update the comment and enhance the commit log for "mm/memory-failure.c:
dissolve truncated hugetlb page"
Thanks David, Yang Shi and Naoya for review!
---
Miaohe Lin (2):
mm/memory-failure.c: minor cleanup for HWPoisonHandlable mm/memory-failure.c: dissolve truncated hugetlb page
mm/memory-failure.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
Signature · 1 line
2.23.0
Miaohe Lin
maintainerPATCH v2 1/2 mm/memory-failure.c: minor cleanup for HWPoisonHandlable
The local variable movable can be removed by returning true directly. Also fix typo 'mirgate'. No functional change intended.
--- mm/memory-failure.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
mm/memory-failure.c +3 -5
@@ -1179,13 +1179,11 @@ void ClearPageHWPoisonTakenOff(struct page *page)*/ static inline bool HWPoisonHandlable (struct page *page,unsigned long flags) { -bool movable = false; - -/* Soft offline could mirgate non-LRU movable pages */ +/* Soft offline could migrate non-LRU movable pages */ if ((flags &MF_SOFT_OFFLINE ) &&__PageMovable (page)) - movable = true; +return true; -return movable ||PageLRU (page) ||is_free_buddy_page (page); +return PageLRU (page) ||is_free_buddy_page (page); }static int __get_hwpoison_page (struct page *page,unsigned long flags)
Signature · 1 line
2.23.0
Miaohe Lin
maintainerPATCH v2 2/2 mm/memory-failure.c: dissolve truncated hugetlb page
In reply to Miaohe LinIf me_huge_page meets a truncated but not yet freed hugepage, it won't be dissolved even if we hold the last refcnt. It's because the hugepage has NULL page_mapping while it's not anonymous hugepage too. Thus we lose the last chance to dissolve it into buddy to save healthy subpages. Remove PageAnon check to handle these hugepages too.
--- mm/memory-failure.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
mm/memory-failure.c +4 -5
@@ -1041,12 +1041,11 @@ static int me_huge_page(struct page_state *ps, struct page *p) res =MF_FAILED ;unlock_page (hpage);/* -* migration entry prevents later access on error anonymous -* hugepage, so we can free and dissolve it into buddy to -* save healthy subpages. +* migration entry prevents later access on error hugepage, +* so we can free and dissolve it into buddy to save healthy +* subpages. */ -if (PageAnon (hpage)) -put_page (hpage); +put_page (hpage);if (__page_handle_poison (p)) {page_ref_inc (p); res =MF_RECOVERED ;
Signature · 1 line
2.23.0
Re: [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page
Quoted 7 lines · Miaohe Lin
If
me_huge_pagemeets a truncated but not yet freed hugepage, it won't be dissolved even if we hold the last refcnt. It's because the hugepage has NULLpage_mappingwhile it's not anonymous hugepage too. Thus we lose the last chance to dissolve it into buddy to save healthy subpages. Remove PageAnon check to handle these hugepages too.Signed-off-by Miaohe Lin <[email protected]>
Thank you for the update.