提交 c122b208 编写于 作者: J Joonsoo Kim 提交者: Linus Torvalds

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: NJoonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: NVlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 be1aa03b
...@@ -526,8 +526,25 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, ...@@ -526,8 +526,25 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
/* If isolation recently failed, do not retry */ /* If isolation recently failed, do not retry */
pageblock_nr = low_pfn >> pageblock_order; pageblock_nr = low_pfn >> pageblock_order;
if (!isolation_suitable(cc, page)) if (last_pageblock_nr != pageblock_nr) {
goto next_pageblock; int mt;
last_pageblock_nr = pageblock_nr;
if (!isolation_suitable(cc, page))
goto next_pageblock;
/*
* For async migration, also only scan in MOVABLE
* blocks. Async migration is optimistic to see if
* the minimum amount of work satisfies the allocation
*/
mt = get_pageblock_migratetype(page);
if (!cc->sync && !migrate_async_suitable(mt)) {
cc->finished_update_migrate = true;
skipped_async_unsuitable = true;
goto next_pageblock;
}
}
/* /*
* Skip if free. page_order cannot be used without zone->lock * Skip if free. page_order cannot be used without zone->lock
...@@ -536,18 +553,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, ...@@ -536,18 +553,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
if (PageBuddy(page)) if (PageBuddy(page))
continue; continue;
/*
* For async migration, also only scan in MOVABLE blocks. Async
* migration is optimistic to see if the minimum amount of work
* satisfies the allocation
*/
if (!cc->sync && last_pageblock_nr != pageblock_nr &&
!migrate_async_suitable(get_pageblock_migratetype(page))) {
cc->finished_update_migrate = true;
skipped_async_unsuitable = true;
goto next_pageblock;
}
/* /*
* Check may be lockless but that's ok as we recheck later. * Check may be lockless but that's ok as we recheck later.
* It's possible to migrate LRU pages and balloon pages * It's possible to migrate LRU pages and balloon pages
...@@ -639,7 +644,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc, ...@@ -639,7 +644,6 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
next_pageblock: next_pageblock:
low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1; low_pfn = ALIGN(low_pfn + 1, pageblock_nr_pages) - 1;
last_pageblock_nr = pageblock_nr;
} }
acct_isolated(zone, locked, cc); acct_isolated(zone, locked, cc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册