The patch titled Subject: mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8 has been added to the -mm mm-unstable branch. Its filename is mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Naoya Horiguchi <naoya.horiguchi@xxxxxxxxx> Subject: mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8 Date: Tue, 25 Oct 2022 14:35:59 +0900 remove TestClearHPageMigratable and reduce to test and clear separately Link: https://lkml.kernel.org/r/20221025053559.GA2104800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxxxx> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Jane Chu <jane.chu@xxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx> Cc: Yang Shi <shy828301@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/hugetlb.h~mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8 +++ a/include/linux/hugetlb.h @@ -623,10 +623,6 @@ void folio_clear_hugetlb_##flname(struct } \ static inline void ClearHPage##uname(struct page *page) \ { clear_bit(HPG_##flname, &(page->private)); } - -#define TESTCLEARHPAGEFLAG(uname, flname) \ -static inline int TestClearHPage##uname(struct page *page) \ - { return test_and_clear_bit(HPG_##flname, &(page->private)); } #else #define TESTHPAGEFLAG(uname, flname) \ static inline bool \ @@ -648,10 +644,6 @@ folio_clear_hugetlb_##flname(struct foli { } \ static inline void ClearHPage##uname(struct page *page) \ { } - -#define TESTCLEARHPAGEFLAG(uname, flname) \ -static inline int TestClearHPage##uname(struct page *page) \ - { return 0; } #endif #define HPAGEFLAG(uname, flname) \ @@ -664,7 +656,6 @@ static inline int TestClearHPage##uname( */ HPAGEFLAG(RestoreReserve, restore_reserve) HPAGEFLAG(Migratable, migratable) - TESTCLEARHPAGEFLAG(Migratable, migratable) HPAGEFLAG(Temporary, temporary) HPAGEFLAG(Freed, freed) HPAGEFLAG(VmemmapOptimized, vmemmap_optimized) --- a/mm/memory-failure.c~mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8 +++ a/mm/memory-failure.c @@ -1823,8 +1823,10 @@ int __get_huge_page_for_hwpoison(unsigne * Clearing HPageMigratable for hwpoisoned hugepages to prevent them * from being migrated by memory hotremove. */ - if (count_increased) - *migratable_cleared = TestClearHPageMigratable(head); + if (count_increased && HPageMigratable(head)) { + ClearHPageMigratable(head); + *migratable_cleared = true; + } return ret; out: _ Patches currently in -mm which might be from naoya.horiguchi@xxxxxxxxx are mmhwpoisonhugetlbmemory_hotplug-hotremove-memory-section-with-hwpoisoned-hugepage-v8.patch