Re: [RFC 1/3] mm, Make __get_user_pages return -EHWPOISON forHWPOISON page optionally

From: Andrew Morton
Date: Wed Dec 22 2010 - 19:54:30 EST


On Thu, 23 Dec 2010 08:39:59 +0800
Huang Ying <ying.huang@xxxxxxxxx> wrote:

> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -1449,9 +1449,16 @@ int __get_user_pages(struct task_struct
> > > if (ret & VM_FAULT_ERROR) {
> > > if (ret & VM_FAULT_OOM)
> > > return i ? i : -ENOMEM;
> > > - if (ret &
> > > - (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE|
> > > - VM_FAULT_SIGBUS))
> > > + if (ret & (VM_FAULT_HWPOISON |
> > > + VM_FAULT_HWPOISON_LARGE)) {
> > > + if (i)
> > > + return i;
> > > + else if (gup_flags & FOLL_HWPOISON)
> > > + return -EHWPOISON;
> > > + else
> > > + return -EFAULT;
> > > + }
> > > + if (ret & VM_FAULT_SIGBUS)
> >
> > hm, that function is getting a bit unweildy.
>
> Yes. Do you think the following code is better?
>
> return i ? i : (gup_flags & FOLL_HWPOISON) ? -EHWPOISON : -EFAULT;

nope ;)

The function just needs to be ripped up and redone somehow. That's not
an appropriate activity in the context of this patch though.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/