Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938690AbZDJHgC (ORCPT ); Fri, 10 Apr 2009 03:36:02 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S938365AbZDJHbX (ORCPT ); Fri, 10 Apr 2009 03:31:23 -0400 Received: from mga14.intel.com ([143.182.124.37]:54962 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938875AbZDJHbW (ORCPT ); Fri, 10 Apr 2009 03:31:22 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.40,165,1239001200"; d="scan'208";a="130029871" Date: Fri, 10 Apr 2009 15:30:42 +0800 From: Wu Fengguang To: Andrew Morton Cc: Ying Han , "linux-mm@kvack.org" , linux-kernel , "torvalds@linux-foundation.org" , Ingo Molnar , Mike Waychison , Rohit Seth , Hugh Dickins , Peter Zijlstra , "H. Peter Anvin" , =?utf-8?B?VMO2csO2aw==?= Edwin , Lee Schermerhorn , Nick Piggin Subject: Re: [PATCH][1/2]page_fault retry with NOPAGE_RETRY Message-ID: <20090410073042.GB21149@localhost> References: <604427e00904081302m7b29c538u7781cd8f4dd576f2@mail.gmail.com> <20090409230205.310c68a7.akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090409230205.310c68a7.akpm@linux-foundation.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1390 Lines: 47 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/