Re: [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb
From: Oscar Salvador
Date: Wed May 13 2026 - 04:38:28 EST
On Wed, May 13, 2026 at 02:50:56PM +0800, Ye Liu wrote:
> > -static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb)
> > +static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags)
> > {
> > return 0;
> > }
> > @@ -2386,8 +2385,11 @@ int memory_failure(unsigned long pfn, int flags)
> > }
> >
> > try_again:
> > - res = try_memory_failure_hugetlb(pfn, flags, &hugetlb);
> > - if (hugetlb)
> > + res = try_memory_failure_hugetlb(pfn, flags);
> > + /*
> > + * -ENOENT means the page we found is not hugetlb, so proceed with normal page handling
> > + */
> > + if (res != -ENOENT)
> > goto unlock_mutex;
> >
> > if (TestSetPageHWPoison(p)) {
> >
> >
>
>
> Hi Oscar,
>
> Good point. Using -ENOENT to distinguish "not a hugetlb page" from
> "hugetlb handled" is indeed cleaner than carrying an extra output
> parameter.
>
> One thing to note: the #else stub when CONFIG_HUGETLB_PAGE is not set
> currently does:
>
> return 0;
>
> which with your change would mean "hugetlb handled, skip normal path"
> instead of the intended "not hugetlb, proceed with normal handling".
> It should be changed to:
>
> return -ENOENT;
Right, let us see if Miaohe sees any issue with that approach.
--
Oscar Salvador
SUSE Labs