linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Shachar Raindel <raindel@mellanox.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"riel@redhat.com" <riel@redhat.com>,
	"ak@linux.intel.com" <ak@linux.intel.com>,
	"matthew.r.wilcox@intel.com" <matthew.r.wilcox@intel.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"n-horiguchi@ah.jp.nec.com" <n-horiguchi@ah.jp.nec.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	Haggai Eran <haggaie@mellanox.com>,
	"aarcange@redhat.com" <aarcange@redhat.com>,
	"pfeiner@google.com" <pfeiner@google.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	Sagi Grimberg <sagig@mellanox.com>,
	"walken@google.com" <walken@google.com>
Subject: Re: [PATCH 1/5] mm: Refactor do_wp_page, extract the reuse case
Date: Mon, 1 Dec 2014 14:50:24 +0200	[thread overview]
Message-ID: <20141201125024.GC13856@node.dhcp.inet.fi> (raw)
In-Reply-To: <297b07d8c87a4077a7140d39a68c1eb0@AM3PR05MB0935.eurprd05.prod.outlook.com>

On Mon, Dec 01, 2014 at 12:34:30PM +0000, Shachar Raindel wrote:
> 
> 
> > -----Original Message-----
> > From: Kirill A. Shutemov [mailto:kirill@shutemov.name]
> > Sent: Monday, December 01, 2014 2:31 PM
> > To: Shachar Raindel
> > Cc: linux-mm@kvack.org; kirill.shutemov@linux.intel.com;
> > mgorman@suse.de; riel@redhat.com; ak@linux.intel.com;
> > matthew.r.wilcox@intel.com; dave.hansen@linux.intel.com; n-
> > horiguchi@ah.jp.nec.com; akpm@linux-foundation.org; torvalds@linux-
> > foundation.org; Haggai Eran; aarcange@redhat.com; pfeiner@google.com;
> > hannes@cmpxchg.org; Sagi Grimberg; walken@google.com
> > Subject: Re: [PATCH 1/5] mm: Refactor do_wp_page, extract the reuse case
> > 
> > On Mon, Dec 01, 2014 at 02:04:41PM +0200, Shachar Raindel wrote:
> > > When do_wp_page is ending, in several cases it needs to reuse the
> > > existing page. This is achieved by making the page table writable,
> > > and possibly updating the page-cache state.
> > >
> > > Currently, this logic was "called" by using a goto jump. This makes
> > > following the control flow of the function harder. It is also
> > > against the coding style guidelines for using goto.
> > >
> > > As the code can easily be refactored into a specialized function,
> > > refactor it out and simplify the code flow in do_wp_page.
> > >
> > > Signed-off-by: Shachar Raindel <raindel@mellanox.com>
> > > ---
> > >  mm/memory.c | 136 ++++++++++++++++++++++++++++++++++-----------------
> > ---------
> > >  1 file changed, 78 insertions(+), 58 deletions(-)
> > >
> > > diff --git a/mm/memory.c b/mm/memory.c
> > > index 3e50383..61334e9 100644
> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -2020,6 +2020,75 @@ static int do_page_mkwrite(struct
> > vm_area_struct *vma, struct page *page,
> > >  }
> > >
> > >  /*
> > > + * Handle write page faults for pages that can be reused in the
> > current vma
> > > + *
> > > + * This can happen either due to the mapping being with the VM_SHARED
> > flag,
> > > + * or due to us being the last reference standing to the page. In
> > either
> > > + * case, all we need to do here is to mark the page as writable and
> > update
> > > + * any related book-keeping.
> > > + */
> > > +static int wp_page_reuse(struct mm_struct *mm, struct vm_area_struct
> > *vma,
> > > +			 unsigned long address, pte_t *page_table,
> > > +			 spinlock_t *ptl, pte_t orig_pte,
> > > +			 struct page *recycled_page, int dirty_page,
> > 
> > recycled_page? what's wrong with old_page?
> > 
> 
> You are reusing the page in this function, so I was feeling that naming it
> "old" is less indicative than "recycled". However, if you prefer "old", I
> am happy with it.

Sinse it's the only page in the scope, call it simply -- 'page'.

-- 
 Kirill A. Shutemov

--
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>

  reply	other threads:[~2014-12-01 12:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 12:04 [PATCH 0/5] Refactor do_wp_page, no functional change Shachar Raindel
2014-12-01 12:04 ` [PATCH 1/5] mm: Refactor do_wp_page, extract the reuse case Shachar Raindel
2014-12-01 12:30   ` Kirill A. Shutemov
2014-12-01 12:34     ` Shachar Raindel
2014-12-01 12:50       ` Kirill A. Shutemov [this message]
2014-12-01 12:04 ` [PATCH 2/5] mm: Refactor do_wp_page - extract the unlock flow Shachar Raindel
2014-12-01 12:43   ` Kirill A. Shutemov
2014-12-01 12:04 ` [PATCH 3/5] mm: refactor do_wp_page, extract the page copy flow Shachar Raindel
2014-12-01 12:57   ` Kirill A. Shutemov
2014-12-01 12:04 ` [PATCH 4/5] mm: Refactor do_wp_page handling of shared vma into a function Shachar Raindel
2014-12-01 13:03   ` Kirill A. Shutemov
2014-12-01 12:04 ` [PATCH 5/5] mm: Move the MMU-notifier code from wp_page_unlock to wp_page_copy Shachar Raindel
2014-12-01 16:47 ` [PATCH 0/5] Refactor do_wp_page, no functional change Linus Torvalds
2014-12-01 16:53 ` Andi Kleen

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=20141201125024.GC13856@node.dhcp.inet.fi \
    --to=kirill@shutemov.name \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=haggaie@mellanox.com \
    --cc=hannes@cmpxchg.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=mgorman@suse.de \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=pfeiner@google.com \
    --cc=raindel@mellanox.com \
    --cc=riel@redhat.com \
    --cc=sagig@mellanox.com \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@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