Messages in this thread | | | Date | Fri, 10 Apr 2009 15:30:42 +0800 | From | Wu Fengguang <> | Subject | Re: [PATCH][1/2]page_fault retry with NOPAGE_RETRY |
| |
On Fri, Apr 10, 2009 at 02:02:05PM +0800, Andrew Morton wrote: [snip] > > if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) > > return ret; > > > > @@ -2611,8 +2618,10 @@ static int do_linear_fault(struct mm_struct *mm, struct > > { > > pgoff_t pgoff = (((address & PAGE_MASK) > > - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; > > - unsigned int flags = (write_access ? FAULT_FLAG_WRITE : 0); > > + int write = write_access & ~FAULT_FLAG_RETRY; > > + unsigned int flags = (write ? FAULT_FLAG_WRITE : 0); > > > > + flags |= (write_access & FAULT_FLAG_RETRY); > > gee, I'm lost.
So did me.
> Can we please redo this as: > > > int write; > unsigned int flags; > > /* > * Big fat comment explaining the next three lines goes here > */
Basically it's doing a (is_write_access | FAULT_FLAG_RETRY) => (FAULT_FLAG_WRITE | FAULT_FLAG_RETRY) by extracting the bool part: > write = write_access & ~FAULT_FLAG_RETRY; convert bool to a bit flag: > unsigned int flags = (write ? FAULT_FLAG_WRITE : 0); and restore the FAULT_FLAG_RETRY: > flags |= (write_access & FAULT_FLAG_RETRY);
Thanks, Fengguang
| |