diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2014-04-07 18:37:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:35:51 -0400 |
commit | 01ead5340bcf5f3a1cd2452c75516d0ef4d908d7 (patch) | |
tree | eabccdd2c4f1b399ab04e0cc4ed8acff9f2d0281 /mm/compaction.c | |
parent | 7d348b9ea64db0a315d777ce7d4b06697f946503 (diff) |
mm/compaction: do not call suitable_migration_target() on every page
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 <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 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 9a03fdb1fd84..3a1828541dc0 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -244,6 +244,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
244 | struct page *cursor, *valid_page = NULL; | 244 | struct page *cursor, *valid_page = NULL; |
245 | unsigned long flags; | 245 | unsigned long flags; |
246 | bool locked = false; | 246 | bool locked = false; |
247 | bool checked_pageblock = false; | ||
247 | 248 | ||
248 | cursor = pfn_to_page(blockpfn); | 249 | cursor = pfn_to_page(blockpfn); |
249 | 250 | ||
@@ -275,8 +276,16 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
275 | break; | 276 | break; |
276 | 277 | ||
277 | /* Recheck this is a suitable migration target under lock */ | 278 | /* Recheck this is a suitable migration target under lock */ |
278 | if (!strict && !suitable_migration_target(page)) | 279 | if (!strict && !checked_pageblock) { |
279 | break; | 280 | /* |
281 | * We need to check suitability of pageblock only once | ||
282 | * and this isolate_freepages_block() is called with | ||
283 | * pageblock range, so just check once is sufficient. | ||
284 | */ | ||
285 | checked_pageblock = true; | ||
286 | if (!suitable_migration_target(page)) | ||
287 | break; | ||
288 | } | ||
280 | 289 | ||
281 | /* Recheck this is a buddy page under lock */ | 290 | /* Recheck this is a buddy page under lock */ |
282 | if (!PageBuddy(page)) | 291 | if (!PageBuddy(page)) |