Commit 938929f1 authored by Mel Gorman's avatar Mel Gorman Committed by Linus Torvalds

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: default avatarMel Gorman <mgorman@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 937a94c9
...@@ -3388,25 +3388,33 @@ static void setup_zone_migrate_reserve(struct zone *zone) ...@@ -3388,25 +3388,33 @@ static void setup_zone_migrate_reserve(struct zone *zone)
if (page_to_nid(page) != zone_to_nid(zone)) if (page_to_nid(page) != zone_to_nid(zone))
continue; continue;
/* Blocks with reserved pages will never free, skip them. */
block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn);
if (pageblock_is_reserved(pfn, block_end_pfn))
continue;
block_migratetype = get_pageblock_migratetype(page); block_migratetype = get_pageblock_migratetype(page);
/* If this block is reserved, account for it */ /* Only test what is necessary when the reserves are not met */
if (reserve > 0 && block_migratetype == MIGRATE_RESERVE) { if (reserve > 0) {
reserve--; /*
continue; * Blocks with reserved pages will never free, skip
} * them.
*/
block_end_pfn = min(pfn + pageblock_nr_pages, end_pfn);
if (pageblock_is_reserved(pfn, block_end_pfn))
continue;
/* Suitable for reserving if this block is movable */ /* If this block is reserved, account for it */
if (reserve > 0 && block_migratetype == MIGRATE_MOVABLE) { if (block_migratetype == MIGRATE_RESERVE) {
set_pageblock_migratetype(page, MIGRATE_RESERVE); reserve--;
move_freepages_block(zone, page, MIGRATE_RESERVE); continue;
reserve--; }
continue;
/* Suitable for reserving if this block is movable */
if (block_migratetype == MIGRATE_MOVABLE) {
set_pageblock_migratetype(page,
MIGRATE_RESERVE);
move_freepages_block(zone, page,
MIGRATE_RESERVE);
reserve--;
continue;
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment