Re: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned

From: Aili Yao
Date: Tue Mar 02 2021 - 03:16:15 EST


On Fri, 26 Feb 2021 09:58:37 -0800
"Luck, Tony" <tony.luck@xxxxxxxxx> wrote:

> On Fri, Feb 26, 2021 at 10:52:50AM +0800, Aili Yao wrote:
> > Hi naoya,Oscar,david:
> > >
> > > > We could use some negative value (error code) to report the reported case,
> > > > then as you mentioned above, some callers need change to handle the
> > > > new case, and the same is true if you use some positive value.
> > > > My preference is -EHWPOISON, but other options are fine if justified well.
> > >
> > > -EHWPOISON seems like a good fit.
> > >
> > I am OK with the -EHWPOISON error code, But I have one doubt here:
> > When we return this -EHWPOISON error code, Does this means we have to add a new error code
> > to error-base.h or errno.h? Is this easy realized?
>
> The page already poisoned isn't really an error though. Just the result
> of a race condition. What if we added an extra argument to memory_failure()
> so it can tell the caller that the specific reason for the early successful
> return is that the page was already poisoned?
>

It may be not an error, Is it reasonable to return a positive value like MF_HWPOISON, it seems the 0
return code donesn't tell the whole story.

Your patch seems more safer, But I don't know if it's worth such multi module modifications for this case.
It really should be referenced to other maintainers and reviewers and thet can give more expert suggestions.

Thanks!
Aili Yao