On 2022/7/12 11:28, Naoya Horiguchi wrote: > From: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> > > Raw error info list needs to be removed when hwpoisoned hugetlb is > unpoisoned. And unpoison handler needs to know how many errors there > are in the target hugepage. So add them. > > HPageVmemmapOptimized(hpage) and HPageRawHwpUnreliable(hpage)) can't be > unpoisoned, so let's skip them. > > Signed-off-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> > Reported-by: kernel test robot <lkp@xxxxxxxxx> This patch looks good to me with some nits below. > --- ... > > -void hugetlb_clear_page_hwpoison(struct page *hpage) > +static unsigned long free_raw_hwp_pages(struct page *hpage, bool move_flag) > { > struct llist_head *head; > struct llist_node *t, *tnode; > + unsigned long count = 0; > > - if (!HPageRawHwpUnreliable(hpage)) > - ClearPageHWPoison(hpage); > + /* > + * HPageVmemmapOptimized hugepages can't be unpoisoned because > + * struct pages for tail pages are required to free hwpoisoned > + * hugepages. HPageRawHwpUnreliable hugepages shouldn't be > + * unpoisoned by definition. > + */ > + if (HPageVmemmapOptimized(hpage) || HPageRawHwpUnreliable(hpage)) If move_flag == false, i.e. in unpoison case, tail pages are not touched. So HPageVmemmapOptimized can be ignored in this case? Or leave it as above to keep the code simple? > + return 0; > head = raw_hwp_list_head(hpage); > llist_for_each_safe(tnode, t, head->first) { > struct raw_hwp_page *p = container_of(tnode, struct raw_hwp_page, node); > > - SetPageHWPoison(p->page); > + if (move_flag) > + SetPageHWPoison(p->page); > kfree(p); > + count++; > } > llist_del_all(head); > + return count; > +} > + > +void hugetlb_clear_page_hwpoison(struct page *hpage) > +{ > + if (!HPageRawHwpUnreliable(hpage)) It seems we can return here if HPageRawHwpUnreliable as there's nothing to do? Anyway, for what it worth, Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Thanks. > + ClearPageHWPoison(hpage); > + free_raw_hwp_pages(hpage, true); > } > > /*