The patch titled Subject: mm,hwpoison: take free pages off the buddy freelists for hugetlb has been added to the -mm tree. Its filename is mmhwpoison-take-free-pages-off-the-buddy-freelists-for-hugetlb.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mmhwpoison-take-free-pages-off-the-buddy-freelists-for-hugetlb.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mmhwpoison-take-free-pages-off-the-buddy-freelists-for-hugetlb.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Oscar Salvador <osalvador@xxxxxxx> Subject: mm,hwpoison: take free pages off the buddy freelists for hugetlb Currently, free hugetlb get dissolved, but we also need to make sure to take the poisoned subpage off the buddy frelists, so no one stumbles upon it (see previous patch for more information). Link: https://lkml.kernel.org/r/20201013144447.6706-4-osalvador@xxxxxxx Signed-off-by: Oscar Salvador <osalvador@xxxxxxx> Acked-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- a/mm/memory-failure.c~mmhwpoison-take-free-pages-off-the-buddy-freelists-for-hugetlb +++ a/mm/memory-failure.c @@ -809,7 +809,7 @@ static int me_swapcache_clean(struct pag */ static int me_huge_page(struct page *p, unsigned long pfn) { - int res = 0; + int res; struct page *hpage = compound_head(p); struct address_space *mapping; @@ -820,6 +820,7 @@ static int me_huge_page(struct page *p, if (mapping) { res = truncate_error_page(hpage, pfn, mapping); } else { + res = MF_FAILED; unlock_page(hpage); /* * migration entry prevents later access on error anonymous @@ -828,8 +829,10 @@ static int me_huge_page(struct page *p, */ if (PageAnon(hpage)) put_page(hpage); - dissolve_free_huge_page(p); - res = MF_RECOVERED; + if (!dissolve_free_huge_page(p) && take_page_off_buddy(p)) { + page_ref_inc(p); + res = MF_RECOVERED; + } lock_page(hpage); } @@ -1196,9 +1199,13 @@ static int memory_failure_hugetlb(unsign } } unlock_page(head); - dissolve_free_huge_page(p); - action_result(pfn, MF_MSG_FREE_HUGE, MF_DELAYED); - return 0; + res = MF_FAILED; + if (!dissolve_free_huge_page(p) && take_page_off_buddy(p)) { + page_ref_inc(p); + res = MF_RECOVERED; + } + action_result(pfn, MF_MSG_FREE_HUGE, res); + return res == MF_RECOVERED ? 0 : -EBUSY; } lock_page(head); _ Patches currently in -mm which might be from osalvador@xxxxxxx are mmhwpoison-drain-pcplists-before-bailing-out-for-non-buddy-zero-refcount-page.patch mmhwpoison-take-free-pages-off-the-buddy-freelists.patch mmhwpoison-take-free-pages-off-the-buddy-freelists-for-hugetlb.patch mmhwpoison-drop-unneeded-pcplist-draining.patch