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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux