Re: [PATCH v4 2/2] mm,hwpoison: make get_hwpoison_page call get_any_page()

From: Oscar Salvador
Date: Mon May 17 2021 - 08:59:10 EST


On Mon, May 17, 2021 at 01:54:01PM +0900, Naoya Horiguchi wrote:
> static int __get_hwpoison_page(struct page *page)
> {
> struct page *head = compound_head(page);
> @@ -1098,7 +1091,9 @@ static int __get_hwpoison_page(struct page *page)
>
> #ifdef CONFIG_HUGETLB_PAGE
> spin_lock(&hugetlb_lock);
> - if (PageHuge(head) && (HPageFreed(head) || HPageMigratable(head)))
> + if (!PageHuge(head))
> + ret = -EBUSY;

Unless I'm missing something, we will be returning -EBUSY for any non-hugetlb
page, which is not right.
I think what you want is to return -EBUSY in case the page is a hugetlb page
but we cannot grab a refcount because the page is in a floating state, meaning
!HPageFreed && !HPageMigratable.

Right?

--
Oscar Salvador
SUSE L3