linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Reduce the amount of work done when updating min_free_kbytes
@ 2011-11-11 16:21 Mel Gorman
  2011-11-14 23:21 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Mel Gorman @ 2011-11-11 16:21 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm

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.

Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 mm/page_alloc.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9dd443d..c95e4c9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;
+			}
 		}
 
 		/*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-15 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 16:21 [PATCH] mm: Reduce the amount of work done when updating min_free_kbytes Mel Gorman
2011-11-14 23:21 ` Andrew Morton
2011-11-15 12:23   ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).