mm: Reduce the amount of work done when updating min_free_kbytes
Subsystems (2)
PATCH 1/1 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.
--- mm/page_alloc.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-)
mm/page_alloc.c +19 -16
@@ -3401,25 +3401,28 @@ static void setup_zone_migrate_reserve(struct zone *zone)if (page_to_nid (page) !=zone_to_nid (zone))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); -/* If this block is reserved, account for it */ -if (reserve >0 && block_migratetype ==MIGRATE_RESERVE ) { - reserve--; -continue ; - } +/* Only test what is necessary when the reserves are not met */ +if (reserve >0 ) { +/* 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 (reserve >0 && block_migratetype ==MIGRATE_MOVABLE ) { -set_pageblock_migratetype (page,MIGRATE_RESERVE ); -move_freepages_block (zone, page,MIGRATE_RESERVE ); - reserve--; -continue ; +/* If this block is reserved, account for it */ +if (block_migratetype ==MIGRATE_RESERVE ) { + 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 ; + } }/*
Andrew Morton
maintainerQuoted 11 lines · On Fri, 11 Nov 2011 16:21:19 +0000 Mel Gorman <[email protected]> wrote:
When
min_free_kbytesis updated, some pageblocks are markedMIGRATE_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 bysetup_zone_migrate_reserve()improving boot times on 1TB machines.
By how much? :)
(I mainly ask because I'm curious to know how long the kernel takes to boot on a 1TB machine...)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 15 lines · Andrew Morton
Quoted 11 lines · On Fri, 11 Nov 2011 16:21:19 +0000 Mel Gorman <[email protected]> wrote:
When
min_free_kbytesis updated, some pageblocks are markedMIGRATE_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 bysetup_zone_migrate_reserve()improving boot times on 1TB machines.
Quoted 5 lines
By how much? :)
(I mainly ask because I'm curious to know how long the kernel takes to boot on a 1TB machine...)
Good question. I don't have access to the machine but based on the dmesg they posted before and after, this patch reduced boot times by 27 seconds.
With only dmesg, I don't know how long it is taking to start services and mount of the filesystem but assuming no major problems or timeouts from drivers it looks like it is taking about 6 minutes to boot.
Signature · 9 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>