diff options
author | Mel Gorman <mel@csn.ul.ie> | 2011-01-13 18:45:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:34 -0500 |
commit | 9927af740b1b9b1e769310bd0b91425e8047b803 (patch) | |
tree | 5195dfbe36ece987f7e3d7c04b87327a20b16ea6 | |
parent | 7f0f24967b0349798803260b2e4bf347cffa1990 (diff) |
mm: compaction: perform a faster migration scan when migrating asynchronously
try_to_compact_pages() is initially called to only migrate pages
asychronously and kswapd always compacts asynchronously. Both are being
optimistic so it is important to complete the work as quickly as possible
to minimise stalls.
This patch alters the scanner when asynchronous to only consider
MIGRATE_MOVABLE pageblocks as migration candidates. This reduces stalls
when allocating huge pages while not impairing allocation success rates as
a full scan will be performed if necessary after direct reclaim.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/compaction.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index e005a30e968c..b0fbfdfad298 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -240,6 +240,7 @@ static unsigned long isolate_migratepages(struct zone *zone, | |||
240 | struct compact_control *cc) | 240 | struct compact_control *cc) |
241 | { | 241 | { |
242 | unsigned long low_pfn, end_pfn; | 242 | unsigned long low_pfn, end_pfn; |
243 | unsigned long last_pageblock_nr = 0, pageblock_nr; | ||
243 | unsigned long nr_scanned = 0, nr_isolated = 0; | 244 | unsigned long nr_scanned = 0, nr_isolated = 0; |
244 | struct list_head *migratelist = &cc->migratepages; | 245 | struct list_head *migratelist = &cc->migratepages; |
245 | 246 | ||
@@ -280,6 +281,20 @@ static unsigned long isolate_migratepages(struct zone *zone, | |||
280 | if (PageBuddy(page)) | 281 | if (PageBuddy(page)) |
281 | continue; | 282 | continue; |
282 | 283 | ||
284 | /* | ||
285 | * For async migration, also only scan in MOVABLE blocks. Async | ||
286 | * migration is optimistic to see if the minimum amount of work | ||
287 | * satisfies the allocation | ||
288 | */ | ||
289 | pageblock_nr = low_pfn >> pageblock_order; | ||
290 | if (!cc->sync && last_pageblock_nr != pageblock_nr && | ||
291 | get_pageblock_migratetype(page) != MIGRATE_MOVABLE) { | ||
292 | low_pfn += pageblock_nr_pages; | ||
293 | low_pfn = ALIGN(low_pfn, pageblock_nr_pages) - 1; | ||
294 | last_pageblock_nr = pageblock_nr; | ||
295 | continue; | ||
296 | } | ||
297 | |||
283 | /* Try isolate the page */ | 298 | /* Try isolate the page */ |
284 | if (__isolate_lru_page(page, ISOLATE_BOTH, 0) != 0) | 299 | if (__isolate_lru_page(page, ISOLATE_BOTH, 0) != 0) |
285 | continue; | 300 | continue; |