|
@@ -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);
|
|
|
|
|
@@ -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))
|