From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by kanga.kvack.org (Postfix) with ESMTP id 96ACD6B0069 for ; Mon, 1 Dec 2014 07:31:02 -0500 (EST) Received: by mail-wi0-f178.google.com with SMTP id hi2so17116535wib.11 for ; Mon, 01 Dec 2014 04:31:02 -0800 (PST) Received: from jenni2.inet.fi (mta-out1.inet.fi. [62.71.2.195]) by mx.google.com with ESMTP id cz2si29923982wjc.153.2014.12.01.04.31.01 for ; Mon, 01 Dec 2014 04:31:01 -0800 (PST) Date: Mon, 1 Dec 2014 14:30:38 +0200 From: "Kirill A. Shutemov" Subject: Re: [PATCH 1/5] mm: Refactor do_wp_page, extract the reuse case Message-ID: <20141201123038.GA13856@node.dhcp.inet.fi> References: <1417435485-24629-1-git-send-email-raindel@mellanox.com> <1417435485-24629-2-git-send-email-raindel@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417435485-24629-2-git-send-email-raindel@mellanox.com> Sender: owner-linux-mm@kvack.org List-ID: 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, haggaie@mellanox.com, aarcange@redhat.com, pfeiner@google.com, hannes@cmpxchg.org, sagig@mellanox.com, walken@google.com 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 > --- > 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? Otherwise: Acked-by: Kirill A. Shutemov -- 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: email@kvack.org