diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 516ab623d773..671e6c94fed7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3388,25 +3388,33 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3388 | if (page_to_nid(page) != zone_to_nid(zone)) | 3388 | if (page_to_nid(page) != zone_to_nid(zone)) |
3389 | continue; | 3389 | continue; |
3390 | 3390 | ||
3391 | /* Blocks with reserved pages will never free, skip them. */ | ||
3392 | block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn); | ||
3393 | if (pageblock_is_reserved(pfn, block_end_pfn)) | ||
3394 | continue; | ||
3395 | |||
3396 | block_migratetype = get_pageblock_migratetype(page); | 3391 | block_migratetype = get_pageblock_migratetype(page); |
3397 | 3392 | ||
3398 | /* If this block is reserved, account for it */ | 3393 | /* Only test what is necessary when the reserves are not met */ |
3399 | if (reserve > 0 && block_migratetype == MIGRATE_RESERVE) { | 3394 | if (reserve > 0) { |
3400 | reserve--; | 3395 | /* |
3401 | continue; | 3396 | * Blocks with reserved pages will never free, skip |
3402 | } | 3397 | * them. |
3398 | */ | ||
3399 | block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn); | ||
3400 | if (pageblock_is_reserved(pfn, block_end_pfn)) | ||
3401 | continue; | ||
3403 | 3402 | ||
3404 | /* Suitable for reserving if this block is movable */ | 3403 | /* If this block is reserved, account for it */ |
3405 | if (reserve > 0 && block_migratetype == MIGRATE_MOVABLE) { | 3404 | if (block_migratetype == MIGRATE_RESERVE) { |
3406 | set_pageblock_migratetype(page, MIGRATE_RESERVE); | 3405 | reserve--; |
3407 | move_freepages_block(zone, page, MIGRATE_RESERVE); | 3406 | continue; |
3408 | reserve--; | 3407 | } |
3409 | continue; | 3408 | |
3409 | /* Suitable for reserving if this block is movable */ | ||
3410 | if (block_migratetype == MIGRATE_MOVABLE) { | ||
3411 | set_pageblock_migratetype(page, | ||
3412 | MIGRATE_RESERVE); | ||
3413 | move_freepages_block(zone, page, | ||
3414 | MIGRATE_RESERVE); | ||
3415 | reserve--; | ||
3416 | continue; | ||
3417 | } | ||
3410 | } | 3418 | } |
3411 | 3419 | ||
3412 | /* | 3420 | /* |