aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-01-10 18:07:14 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:42 -0500
commit938929f14cb595f43cd1a4e63e22d36cab1e4a1f (patch)
tree54c23d02494c05d13cc6a6ffb327cc1fb03e72fd /mm/page_alloc.c
parent937a94c9db30a818baa5e2c09dbf4589251355c3 (diff)
mm: reduce the amount of work done when updating min_free_kbytes
When min_free_kbytes is updated, some pageblocks are marked MIGRATE_RESERVE. Ordinarily, this work is unnoticable as it happens early in boot but on large machines with 1TB of memory, this has been reported to delay boot times, probably due to the NUMA distances involved. The bulk of the work is due to calling calling pageblock_is_reserved() an unnecessary amount of times and accessing far more struct page metadata than is necessary. This patch significantly reduces the amount of work done by setup_zone_migrate_reserve() improving boot times on 1TB machines. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c40
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 /*