diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2014-04-07 18:37:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:35:51 -0400 |
commit | c122b2087ab94192f2b937e47b563a9c4e688ece (patch) | |
tree | a6ff641d7c64ac845c9a07fdd844fd06f380a9bf /mm/compaction.c | |
parent | be1aa03b973c7dcdc576f3503f7a60429825c35d (diff) |
mm/compaction: check pageblock suitability once per pageblock
isolation_suitable() and migrate_async_suitable() is used to be sure
that this pageblock range is fine to be migragted. It isn't needed to
call it on every page. Current code do well if not suitable, but, don't
do well when suitable.
1) It re-checks isolation_suitable() on each page of a pageblock that was
already estabilished as suitable.
2) It re-checks migrate_async_suitable() on each page of a pageblock that
was not entered through the next_pageblock: label, because
last_pageblock_nr is not otherwise updated.
This patch fixes situation by 1) calling isolation_suitable() only once
per pageblock and 2) always updating last_pageblock_nr to the pageblock
that was just checked.
Additionally, move PageBuddy() check after pageblock unit check, since
pageblock check is the first thing we should do and makes things more
simple.
[vbabka@suse.cz: rephrase commit description]
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 0eb9f99196ce..6878c005bc8e 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -526,8 +526,25 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, | |||
526 | 526 | ||
527 | /* If isolation recently failed, do not retry */ | 527 | /* If isolation recently failed, do not retry */ |
528 | pageblock_nr = low_pfn >> pageblock_order; | 528 | pageblock_nr = low_pfn >> pageblock_order; |
529 | if (!isolation_suitable(cc, page)) | 529 | if (last_pageblock_nr != pageblock_nr) { |
530 | goto next_pageblock; | 530 | int mt; |
531 | |||
532 | last_pageblock_nr = pageblock_nr; | ||
533 | if (!isolation_suitable(cc, page)) | ||
534 | goto next_pageblock; | ||
535 | |||
536 | /* | ||
537 | * For async migration, also only scan in MOVABLE | ||
538 | * blocks. Async migration is optimistic to see if | ||
539 | * the minimum amount of work satisfies the allocation | ||
540 | */ | ||
541 | mt = get_pageblock_migratetype(page); | ||
542 | if (!cc->sync && !migrate_async_suitable(mt)) { | ||
543 | cc->finished_update_migrate = true; | ||
544 | skipped_async_unsuitable = true; | ||
545 | goto next_pageblock; | ||
546 | } | ||
547 | } | ||
531 | 548 | ||
532 | /* | 549 | /* |
533 | * Skip if free. page_order cannot be used without zone->lock | 550 | * Skip if free. page_order cannot be used without zone->lock |
@@ -537,18 +554,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, | |||
537 | continue; | 554 | continue; |
538 | 555 | ||
539 | /* | 556 | /* |
540 | * For async migration, also only scan in MOVABLE blocks. Async | ||
541 | * migration is optimistic to see if the minimum amount of work | ||
542 | * satisfies the allocation | ||
543 | */ | ||
544 | if (!cc->sync && last_pageblock_nr != pageblock_nr && | ||
545 | !migrate_async_suitable(get_pageblock_migratetype(page))) { | ||
546 | cc->finished_update_migrate = true; | ||
547 | skipped_async_unsuitable = true; | ||
548 | goto next_pageblock; | ||
549 | } | ||
550 | |||
551 | /* | ||
552 | * Check may be lockless but that's ok as we recheck later. | 557 | * Check may be lockless but that's ok as we recheck later. |
553 | * It's possible to migrate LRU pages and balloon pages | 558 | * It's possible to migrate LRU pages and balloon pages |
554 | * Skip any other type of page | 559 | * Skip any other type of page |
@@ -639,7 +644,6 @@ check_compact_cluster: | |||
639 | 644 | ||
640 | next_pageblock: | 645 | next_pageblock: |
641 | low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1; | 646 | low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1; |
642 | last_pageblock_nr = pageblock_nr; | ||
643 | } | 647 | } |
644 | 648 | ||
645 | acct_isolated(zone, locked, cc); | 649 | acct_isolated(zone, locked, cc); |