Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbZKOWRA (ORCPT ); Sun, 15 Nov 2009 17:17:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752093AbZKOWQ7 (ORCPT ); Sun, 15 Nov 2009 17:16:59 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:28049 "EHLO mk-filter-2-a-1.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbZKOWQ6 (ORCPT ); Sun, 15 Nov 2009 17:16:58 -0500 X-Trace: 290433774/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.69.56.48/None/hugh.dickins@tiscali.co.uk X-SBRS: None X-RemoteIP: 79.69.56.48 X-IP-MAIL-FROM: hugh.dickins@tiscali.co.uk X-SMTP-AUTH: X-MUA: X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvoAAOcMAEtPRTgw/2dsb2JhbAAI0nmCPIIABA X-IronPort-AV: E=Sophos;i="4.44,747,1249254000"; d="scan'208";a="290433774" Date: Sun, 15 Nov 2009 22:16:54 +0000 (GMT) From: Hugh Dickins X-X-Sender: hugh@sister.anvils To: KOSAKI Motohiro cc: Andrew Morton , Izik Eidus , Andrea Arcangeli , Nick Piggin , Rik van Riel , Lee Schermerhorn , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/6] mm: mlocking in try_to_unmap_one In-Reply-To: <20091113151554.33C2.A69D9226@jp.fujitsu.com> Message-ID: References: <20091113151554.33C2.A69D9226@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2539 Lines: 86 On Fri, 13 Nov 2009, KOSAKI Motohiro wrote: > > Very small nit. How about this? Yes, that takes it a stage further, I prefer that, thanks: but better redo against mmotm, I removed the "MLOCK_PAGES && " in a later patch. Hugh > > > ------------------------------------------------------------ > From 9d4b507572eccf88dcaa02e650df59874216528c Mon Sep 17 00:00:00 2001 > From: KOSAKI Motohiro > Date: Fri, 13 Nov 2009 15:00:04 +0900 > Subject: [PATCH] Simplify try_to_unmap_one() > > SWAP_MLOCK mean "We marked the page as PG_MLOCK, please move it to > unevictable-lru". So, following code is easy confusable. > > if (vma->vm_flags & VM_LOCKED) { > ret = SWAP_MLOCK; > goto out_unmap; > } > > Plus, if the VMA doesn't have VM_LOCKED, We don't need to check > the needed of calling mlock_vma_page(). > > Signed-off-by: KOSAKI Motohiro > --- > mm/rmap.c | 25 ++++++++++++------------- > 1 files changed, 12 insertions(+), 13 deletions(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index 4440a86..81a168c 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -784,10 +784,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > * skipped over this mm) then we should reactivate it. > */ > if (!(flags & TTU_IGNORE_MLOCK)) { > - if (vma->vm_flags & VM_LOCKED) { > - ret = SWAP_MLOCK; > - goto out_unmap; > - } > + if (vma->vm_flags & VM_LOCKED) > + goto out_unlock; > if (MLOCK_PAGES && TTU_ACTION(flags) == TTU_MUNLOCK) > goto out_unmap; > } > @@ -856,18 +854,19 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, > > out_unmap: > pte_unmap_unlock(pte, ptl); > +out: > + return ret; > > - if (MLOCK_PAGES && ret == SWAP_MLOCK) { > - ret = SWAP_AGAIN; > - if (down_read_trylock(&vma->vm_mm->mmap_sem)) { > - if (vma->vm_flags & VM_LOCKED) { > - mlock_vma_page(page); > - ret = SWAP_MLOCK; > - } > - up_read(&vma->vm_mm->mmap_sem); > +out_unlock: > + pte_unmap_unlock(pte, ptl); > + > + if (down_read_trylock(&vma->vm_mm->mmap_sem)) { > + if (vma->vm_flags & VM_LOCKED) { > + mlock_vma_page(page); > + ret = SWAP_MLOCK; > } > + up_read(&vma->vm_mm->mmap_sem); > } > -out: > return ret; > } > > -- > 1.6.2.5 -- 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/