From: Mel Gorman <mgorman@suse.de>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: linux-mm@kvack.org, Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 1/2] mm: compaction: try harder to isolate free pages
Date: Tue, 10 Apr 2012 11:38:33 +0100 [thread overview]
Message-ID: <20120410103833.GE3789@suse.de> (raw)
In-Reply-To: <1333643534-1591-2-git-send-email-b.zolnierkie@samsung.com>
On Thu, Apr 05, 2012 at 06:32:12PM +0200, Bartlomiej Zolnierkiewicz wrote:
> In isolate_freepages() check each page in a pageblock
> instead of checking only first pages of pageblock_nr_pages
> intervals (suitable_migration_target(page) is called before
> isolate_freepages_block() so if page is "unsuitable" whole
> pageblock_nr_pages pages will be ommited from the check).
> It greatly improves possibility of finding free pages to
> isolate during compaction_alloc() phase.
>
> Cc: Mel Gorman <mgorman@suse.de>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> mm/compaction.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index d9ebebe..bc77135 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -65,7 +65,7 @@ static unsigned long isolate_freepages_block(struct zone *zone,
>
> /* Get the last PFN we should scan for free pages at */
> zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
> - end_pfn = min(blockpfn + pageblock_nr_pages, zone_end_pfn);
> + end_pfn = min(blockpfn + 1, zone_end_pfn);
>
> /* Find the first usable PFN in the block to initialse page cursor */
> for (; blockpfn < end_pfn; blockpfn++) {
This changes the meaning of the function significantly. Before your
patch it isolates all the free pages within a block. After your change
it is isolating a single page and the function name should be updated to
reflect that. Of greater concern is that isolate_freepages()
is now calling suitable_migration_target() for every page scanned
calling get_pageblock_migratetype() every time which is slow. Worse, you
are now acquiring the zone lock for every page scanned which is slower
again.
I think the bug you are accidentally fixing is related to how high_pfn
is updated inside that loop. The intent is that when free pages are
isolated that the next scan started from the same place as page
migration may have released those pages again. As it gets updated every
time a page is isolated the scanner is moving faster than it should.
Try this;
diff --git a/mm/compaction.c b/mm/compaction.c
index 74a8c82..177e161 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -139,6 +139,7 @@ static void isolate_freepages(struct zone *zone,
unsigned long flags;
int nr_freepages = cc->nr_freepages;
struct list_head *freelist = &cc->freepages;
+ bool first_isolation = true;
/*
* Initialise the free scanner. The starting point is where we last
@@ -201,8 +202,10 @@ static void isolate_freepages(struct zone *zone,
* looking for free pages, the search will restart here as
* page migration may have returned some pages to the allocator
*/
- if (isolated)
+ if (isolated && first_isolation) {
+ first_isolation = false;
high_pfn = max(high_pfn, pfn);
+ }
}
/* split_free_page does not map the pages */
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-04-10 10:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-05 16:32 [PATCH 0/2] mm: compaction: improve free pages selection Bartlomiej Zolnierkiewicz
2012-04-05 16:32 ` [PATCH 1/2] mm: compaction: try harder to isolate free pages Bartlomiej Zolnierkiewicz
2012-04-06 6:40 ` Minchan Kim
2012-04-06 8:21 ` Bartlomiej Zolnierkiewicz
2012-04-06 8:51 ` Minchan Kim
2012-04-10 10:38 ` Mel Gorman [this message]
2012-04-12 5:42 ` Mel Gorman
2012-04-05 16:32 ` [PATCH 2/2] mm: compaction: allow isolation of lower order buddy pages Bartlomiej Zolnierkiewicz
2012-04-05 21:46 ` David Rientjes
2012-04-06 8:38 ` Bartlomiej Zolnierkiewicz
2012-04-06 6:45 ` Minchan Kim
2012-04-10 10:40 ` Mel Gorman
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=20120410103833.GE3789@suse.de \
--to=mgorman@suse.de \
--cc=b.zolnierkie@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).