Skip to content

Commit

Permalink
mm/compaction: do not call suitable_migration_target() on every page
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoonsooKim authored and torvalds committed Apr 7, 2014
1 parent 7d348b9 commit 01ead53
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
struct page *cursor, *valid_page = NULL;
unsigned long flags;
bool locked = false;
bool checked_pageblock = false;

cursor = pfn_to_page(blockpfn);

Expand Down Expand Up @@ -275,8 +276,16 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
break;

/* Recheck this is a suitable migration target under lock */
if (!strict && !suitable_migration_target(page))
break;
if (!strict && !checked_pageblock) {
/*
* We need to check suitability of pageblock only once
* and this isolate_freepages_block() is called with
* pageblock range, so just check once is sufficient.
*/
checked_pageblock = true;
if (!suitable_migration_target(page))
break;
}

/* Recheck this is a buddy page under lock */
if (!PageBuddy(page))
Expand Down

0 comments on commit 01ead53

Please sign in to comment.