From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755514AbaBTQt4 (ORCPT ); Thu, 20 Feb 2014 11:49:56 -0500 Received: from cantor2.suse.de ([195.135.220.15]:57308 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755141AbaBTQtz (ORCPT ); Thu, 20 Feb 2014 11:49:55 -0500 Message-ID: <5306322E.3030607@suse.cz> Date: Thu, 20 Feb 2014 17:49:50 +0100 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Joonsoo Kim , Andrew Morton CC: Mel Gorman , Joonsoo Kim , Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/5] mm/compaction: do not call suitable_migration_target() on every page References: <1392360843-22261-1-git-send-email-iamjoonsoo.kim@lge.com> <1392360843-22261-3-git-send-email-iamjoonsoo.kim@lge.com> In-Reply-To: <1392360843-22261-3-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/14/2014 07:54 AM, Joonsoo Kim wrote: > suitable_migration_target() checks that pageblock is suitable for > migration target. In isolate_freepages_block(), it is called on every > page and this is inefficient. So make it called once per pageblock. > > suitable_migration_target() also checks if page is highorder or not, > but it's criteria for highorder is pageblock order. So calling it once > within pageblock range has no problem. > > Signed-off-by: Joonsoo Kim Acked-by: Vlastimil Babka > diff --git a/mm/compaction.c b/mm/compaction.c > index bbe1260..0d821a2 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -245,6 +245,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > unsigned long nr_strict_required = end_pfn - blockpfn; > unsigned long flags; > bool locked = false; > + bool checked_pageblock = false; > > cursor = pfn_to_page(blockpfn); > > @@ -275,8 +276,16 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > break; > > /* Recheck this is a suitable migration target under lock */ > - if (!strict && !suitable_migration_target(page)) > - break; > + if (!strict && !checked_pageblock) { > + /* > + * We need to check suitability of pageblock only once > + * and this isolate_freepages_block() is called with > + * pageblock range, so just check once is sufficient. > + */ > + checked_pageblock = true; > + if (!suitable_migration_target(page)) > + break; > + } > > /* Recheck this is a buddy page under lock */ > if (!PageBuddy(page)) > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by kanga.kvack.org (Postfix) with ESMTP id 5509A6B009C for ; Thu, 20 Feb 2014 11:49:56 -0500 (EST) Received: by mail-we0-f179.google.com with SMTP id q58so1631272wes.24 for ; Thu, 20 Feb 2014 08:49:55 -0800 (PST) Received: from mx2.suse.de (cantor2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id gt3si5928267wib.8.2014.02.20.08.49.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Feb 2014 08:49:54 -0800 (PST) Message-ID: <5306322E.3030607@suse.cz> Date: Thu, 20 Feb 2014 17:49:50 +0100 From: Vlastimil Babka MIME-Version: 1.0 Subject: Re: [PATCH v2 2/5] mm/compaction: do not call suitable_migration_target() on every page References: <1392360843-22261-1-git-send-email-iamjoonsoo.kim@lge.com> <1392360843-22261-3-git-send-email-iamjoonsoo.kim@lge.com> In-Reply-To: <1392360843-22261-3-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Joonsoo Kim , Andrew Morton Cc: Mel Gorman , Joonsoo Kim , Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org On 02/14/2014 07:54 AM, Joonsoo Kim wrote: > suitable_migration_target() checks that pageblock is suitable for > migration target. In isolate_freepages_block(), it is called on every > page and this is inefficient. So make it called once per pageblock. > > suitable_migration_target() also checks if page is highorder or not, > but it's criteria for highorder is pageblock order. So calling it once > within pageblock range has no problem. > > Signed-off-by: Joonsoo Kim Acked-by: Vlastimil Babka > diff --git a/mm/compaction.c b/mm/compaction.c > index bbe1260..0d821a2 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -245,6 +245,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > unsigned long nr_strict_required = end_pfn - blockpfn; > unsigned long flags; > bool locked = false; > + bool checked_pageblock = false; > > cursor = pfn_to_page(blockpfn); > > @@ -275,8 +276,16 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, > break; > > /* Recheck this is a suitable migration target under lock */ > - if (!strict && !suitable_migration_target(page)) > - break; > + if (!strict && !checked_pageblock) { > + /* > + * We need to check suitability of pageblock only once > + * and this isolate_freepages_block() is called with > + * pageblock range, so just check once is sufficient. > + */ > + checked_pageblock = true; > + if (!suitable_migration_target(page)) > + break; > + } > > /* Recheck this is a buddy page under lock */ > if (!PageBuddy(page)) > -- 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