Re: [PATCH v8 06/15] kpageflags: Use is_page_hwpoison() to set KPF_HWPOISON

[email protected] Mon, 3 Aug 2026 23:44:28 -0700
Newsgroups gmane.linux.file-systems,gmane.linux.kernel.mm
Message-ID <[email protected]>

On 7/31/2026 1:07 PM, Matthew Wilcox (Oracle) wrote:
> Instead of knowing how hugetlb handles hwpoison, just ask=20
> is_page_hwpoison(). This gives us the flexibility to change how hwpoison=
=20
> is handled without updating this function in the future. Signed-off-by:=20
> Matthew Wilcox (Oracle) <willy@=E2=80=8Ainfradead.=E2=80=8Aorg>
>=20
>=20
> Instead of knowing how hugetlb handles hwpoison, just ask
> is_page_hwpoison().  This gives us the flexibility to change how hwpoison
> is handled without updating this function in the future.
>=20
> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
> ---
>   fs/proc/page.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>=20
> diff --git a/fs/proc/page.c b/fs/proc/page.c
> index 7d9387143435..28c9a7b724f3 100644
> --- a/fs/proc/page.c
> +++ b/fs/proc/page.c
> @@ -233,12 +233,8 @@ u64 stable_page_flags(const struct page *page)
>   	u |=3D kpf_copy_bit(k, KPF_UNEVICTABLE,	PG_unevictable);
>   	u |=3D kpf_copy_bit(k, KPF_MLOCKED,	PG_mlocked);
>  =20
> -#ifdef CONFIG_MEMORY_FAILURE
> -	if (u & (1 << KPF_HUGE))
> -		u |=3D kpf_copy_bit(k, KPF_HWPOISON,	PG_hwpoison);
> -	else
> -		u |=3D kpf_copy_bit(ps.page_snapshot.flags.f, KPF_HWPOISON, PG_hwpoiso=
n);
> -#endif
> +	if (is_page_hwpoison(page))
> +		u |=3D KPF_HWPOISON;
>  =20
>   	u |=3D kpf_copy_bit(k, KPF_RESERVED,	PG_reserved);
>   	u |=3D kpf_copy_bit(k, KPF_OWNER_2,	PG_owner_2);
> --=20
> 2.47.3
>=20

Good idea, but agreed with Sushiko about the bit setting issue,
with that fixed,

Reviewed-by: Jane Chu <[email protected]>

thanks,
-jane