Re: [PATCH v7 11/14] mm,hwpoison: return 0 if the page is already poisoned in soft-offline
From: HORIGUCHI NAOYA(堀口 直也)
Date: Wed Sep 23 2020 - 03:39:19 EST
On Tue, Sep 22, 2020 at 03:56:47PM +0200, Oscar Salvador wrote:
> Currently, there is an inconsistency when calling soft-offline from
> different paths on a page that is already poisoned.
>
> 1) madvise:
>
> madvise_inject_error skips any poisoned page and continues
> the loop.
> If that was the only page to madvise, it returns 0.
>
> 2) /sys/devices/system/memory/:
>
> When calling soft_offline_page_store()->soft_offline_page(),
> we return -EBUSY in case the page is already poisoned.
> This is inconsistent with a) the above example and b)
> memory_failure, where we return 0 if the page was poisoned.
>
> Fix this by dropping the PageHWPoison() check in madvise_inject_error, and
> let soft_offline_page return 0 if it finds the page already poisoned.
>
> Please, note that this represents a user-api change, since now the return
> error when calling soft_offline_page_store()->soft_offline_page() will be
> different.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
Acked-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>