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 - 08:01:25 EST


On 2022/6/27 16:32, Miaohe Lin wrote:
> 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?

Sorry. I re-read patch 4/9 and I found hugetlb_set_page_hwpoison will increment the
num_poisoned_pages for each subpages. Please ignore this question.

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