Messages in this thread | | | From | HORIGUCHI NAOYA(堀口 直也) <> | Subject | Re: [PATCH v3 1/4] mm,hwpoison,hugetlb,memory_hotplug: hotremove memory section with hwpoisoned hugepage | Date | Fri, 7 Oct 2022 00:45:23 +0000 |
| |
On Wed, Sep 28, 2022 at 05:32:12PM +0800, Miaohe Lin wrote: > On 2022/9/28 9:26, Naoya Horiguchi wrote: > >>> @@ -1815,6 +1815,13 @@ int __get_huge_page_for_hwpoison(unsigned long pfn, int flags) ... > >>> @@ -1862,6 +1869,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb > >>> > >>> if (hwpoison_filter(p)) { > >>> hugetlb_clear_page_hwpoison(head); > >>> + SetHPageMigratable(head); > >> > >> Would we set HPageMigratable flag for free hugetlb pages here? IIUC, they're not expected to have this flag set. > > > > Thank you, you're right. This should be done in "if (res == 1)" block. > > If res == 1, it means hugetlb page refcnt is incremented. But it seems this does not necessarily mean > HPageMigratable is cleared by __get_huge_page_for_hwpoison() if the hugetlb page is already isolated. > If so, we might set HPageMigratable flag back for already isolated hugetlb pages?
# sorry for my late reply, I was busy with personal matters these days...
Yes, that could happen (and also in the case where MF_COUNT_INCREASED is set). We need store whether HPageMigratable flag is cleared or not in __get_huge_page_for_hwpoison(). I'll add a parameter to __get_huge_page_for_hwpoison() to return the flag change to the caller. But I also think that there're a few internal states during error handling, so it might be good to add some structure like "struct hwpoison_control" to save such internal states over related functions (not in this series).
Thanks, Naoya Horiguchi | |