mm: reduce the amount of work done when updating min_free_kbytes
authorMel Gorman <mgorman@suse.de>
Tue, 10 Jan 2012 23:07:14 +0000 (15:07 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 Aug 2012 13:37:29 +0000 (14:37 +0100)
commitc653414d1983c064934ff3aa66bea2d7297f8222
treea8fe5512ff81c3f36b43d94bc1ca8fcf3be5e839
parentf1e79c6abb1e5420fb35e9e8a634efec9fc9ba96
mm: reduce the amount of work done when updating min_free_kbytes

commit 938929f14cb595f43cd1a4e63e22d36cab1e4a1f upstream.

Stable note: Fixes https://bugzilla.novell.com/show_bug.cgi?id=726210 .
        Large machines with 1TB or more of RAM take a long time to boot
        without this patch and may spew out soft lockup warnings.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
mm/page_alloc.c