Re: [PATCH v2 5/9] mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage

From: Miaohe Lin
Date: Mon Jun 27 2022 - 04:32:55 EST


On 2022/6/24 7:51, Naoya Horiguchi wrote:
> From: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>
>
> Raw error info list needs to be removed when hwpoisoned hugetlb is
> unpoisioned. And unpoison handler needs to know how many errors there
> are in the target hugepage. So add them.
>
> Signed-off-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>

snip

> @@ -2255,7 +2275,7 @@ int unpoison_memory(unsigned long pfn)
> unlock_mutex:
> mutex_unlock(&mf_mutex);
> if (!ret || freeit) {
> - num_poisoned_pages_dec();
> + num_poisoned_pages_sub(count);

IIUC, num_poisoned_pages will only be incremented once for hugetlb page. If many
subpages are hwpoisoned, they will reach the "else if (res == -EHWPOISON)" path
in try_memory_failure_hugetlb and thus num_poisoned_pages_inc is ignored. Maybe
that should be changed so subpages can contribute to the num_poisoned_pages
or should we just do num_poisoned_pages_dec here? Or am I miss something?

Thanks!

> unpoison_pr_info("Unpoison: Software-unpoisoned page %#lx\n",
> page_to_pfn(p), &unpoison_rs);
> }
>