aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/page_alloc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f12052dc23ff..f26fdc94393e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2877,20 +2877,23 @@ static void __init sort_node_map(void)
2877 cmp_node_active_region, NULL); 2877 cmp_node_active_region, NULL);
2878} 2878}
2879 2879
2880/* Find the lowest pfn for a node. This depends on a sorted early_node_map */ 2880/* Find the lowest pfn for a node */
2881unsigned long __init find_min_pfn_for_node(unsigned long nid) 2881unsigned long __init find_min_pfn_for_node(unsigned long nid)
2882{ 2882{
2883 int i; 2883 int i;
2884 2884 unsigned long min_pfn = ULONG_MAX;
2885 /* Regions in the early_node_map can be in any order */
2886 sort_node_map();
2887 2885
2888 /* Assuming a sorted map, the first range found has the starting pfn */ 2886 /* Assuming a sorted map, the first range found has the starting pfn */
2889 for_each_active_range_index_in_nid(i, nid) 2887 for_each_active_range_index_in_nid(i, nid)
2890 return early_node_map[i].start_pfn; 2888 min_pfn = min(min_pfn, early_node_map[i].start_pfn);
2891 2889
2892 printk(KERN_WARNING "Could not find start_pfn for node %lu\n", nid); 2890 if (min_pfn == ULONG_MAX) {
2893 return 0; 2891 printk(KERN_WARNING
2892 "Could not find start_pfn for node %lu\n", nid);
2893 return 0;
2894 }
2895
2896 return min_pfn;
2894} 2897}
2895 2898
2896/** 2899/**
@@ -2939,6 +2942,9 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
2939 unsigned long nid; 2942 unsigned long nid;
2940 enum zone_type i; 2943 enum zone_type i;
2941 2944
2945 /* Sort early_node_map as initialisation assumes it is sorted */
2946 sort_node_map();
2947
2942 /* Record where the zone boundaries are */ 2948 /* Record where the zone boundaries are */
2943 memset(arch_zone_lowest_possible_pfn, 0, 2949 memset(arch_zone_lowest_possible_pfn, 0,
2944 sizeof(arch_zone_lowest_possible_pfn)); 2950 sizeof(arch_zone_lowest_possible_pfn));