linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Ying Han" <yinghan@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Mike Waychison" <mikew@google.com>,
	"Rohit Seth" <rohitseth@google.com>,
	"Hugh Dickins" <hugh@veritas.com>,
	"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Török Edwin" <edwintorok@gmail.com>,
	"Lee Schermerhorn" <lee.schermerhorn@hp.com>,
	"Nick Piggin" <npiggin@suse.de>
Subject: Re: [PATCH][1/2]page_fault retry with NOPAGE_RETRY
Date: Fri, 10 Apr 2009 15:30:42 +0800	[thread overview]
Message-ID: <20090410073042.GB21149@localhost> (raw)
In-Reply-To: <20090409230205.310c68a7.akpm@linux-foundation.org>

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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2009-04-10  7:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 20:02 Ying Han
2009-04-09  7:47 ` Wu Fengguang
2009-04-09 16:21   ` Ying Han
2009-04-10  0:25     ` Wu Fengguang
2009-04-10  6:02 ` Andrew Morton
2009-04-10  6:32   ` Ying Han
2009-04-10  6:48     ` Wu Fengguang
2009-04-10  7:30   ` Wu Fengguang [this message]
2009-04-10 16:01     ` Linus Torvalds
2009-04-10 16:04       ` [PATCH 1/2] Remove internal use of 'write_access' in mm/memory.c Linus Torvalds
2009-04-10 16:09       ` [PATCH 2/2] Move FAULT_FLAG_xyz into handle_mm_fault() callers Linus Torvalds
2009-04-10 19:15         ` Ying Han
2009-04-10 19:22           ` Linus Torvalds
2009-04-14  7:09         ` Nick Piggin
2009-04-10 17:57       ` [PATCH][1/2]page_fault retry with NOPAGE_RETRY Ying Han
2009-04-08 20:06 Ying Han

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090410073042.GB21149@localhost \
    --to=fengguang.wu@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=edwintorok@gmail.com \
    --cc=hpa@zytor.com \
    --cc=hugh@veritas.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikew@google.com \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=rohitseth@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=yinghan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox