Commit 1abbfb41 authored by Mel Gorman's avatar Mel Gorman Committed by Linus Torvalds

[PATCH] x86_64: fix bad page state in process 'swapper'

find_min_pfn_for_node() and find_min_pfn_with_active_regions() both
depend on a sorted early_node_map[].  However, sort_node_map() is being
called after fin_min_pfn_with_active_regions() in
free_area_init_nodes().

In most cases, this is ok, but on at least one x86_64, the SRAT table
caused the E820 ranges to be registered out of order.  This gave the
wrong values for the min PFN range resulting in some pages not being
initialised.

This patch sorts the early_node_map in find_min_pfn_for_node().  It has
been boot tested on x86, x86_64, ppc64 and ia64.
Signed-off-by: default avatarMel Gorman <mel@csn.ul.ie>
Acked-by: default avatarAndre Noll <maan@systemlinux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0b1082ef
...@@ -2612,6 +2612,9 @@ unsigned long __init find_min_pfn_for_node(unsigned long nid) ...@@ -2612,6 +2612,9 @@ unsigned long __init find_min_pfn_for_node(unsigned long nid)
{ {
int i; int i;
/* Regions in the early_node_map can be in any order */
sort_node_map();
/* Assuming a sorted map, the first range found has the starting pfn */ /* Assuming a sorted map, the first range found has the starting pfn */
for_each_active_range_index_in_nid(i, nid) for_each_active_range_index_in_nid(i, nid)
return early_node_map[i].start_pfn; return early_node_map[i].start_pfn;
...@@ -2680,9 +2683,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) ...@@ -2680,9 +2683,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]);
} }
/* Regions in the early_node_map can be in any order */
sort_node_map();
/* Print out the zone ranges */ /* Print out the zone ranges */
printk("Zone PFN ranges:\n"); printk("Zone PFN ranges:\n");
for (i = 0; i < MAX_NR_ZONES; i++) for (i = 0; i < MAX_NR_ZONES; i++)
......
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