aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c8
-rw-r--r--mm/page_alloc.c19
-rw-r--r--mm/sparse.c7
3 files changed, 20 insertions, 14 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 1ae2b2cc3a54..70df5c0d957e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -91,8 +91,8 @@ static void grow_zone_span(struct zone *zone,
91 if (start_pfn < zone->zone_start_pfn) 91 if (start_pfn < zone->zone_start_pfn)
92 zone->zone_start_pfn = start_pfn; 92 zone->zone_start_pfn = start_pfn;
93 93
94 if (end_pfn > old_zone_end_pfn) 94 zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
95 zone->spanned_pages = end_pfn - zone->zone_start_pfn; 95 zone->zone_start_pfn;
96 96
97 zone_span_writeunlock(zone); 97 zone_span_writeunlock(zone);
98} 98}
@@ -106,8 +106,8 @@ static void grow_pgdat_span(struct pglist_data *pgdat,
106 if (start_pfn < pgdat->node_start_pfn) 106 if (start_pfn < pgdat->node_start_pfn)
107 pgdat->node_start_pfn = start_pfn; 107 pgdat->node_start_pfn = start_pfn;
108 108
109 if (end_pfn > old_pgdat_end_pfn) 109 pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
110 pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn; 110 pgdat->node_start_pfn;
111} 111}
112 112
113int online_pages(unsigned long pfn, unsigned long nr_pages) 113int online_pages(unsigned long pfn, unsigned long nr_pages)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 813b4ec1298a..253a450c400d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -951,7 +951,7 @@ restart:
951 goto got_pg; 951 goto got_pg;
952 952
953 do { 953 do {
954 if (cpuset_zone_allowed(*z, gfp_mask)) 954 if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL))
955 wakeup_kswapd(*z, order); 955 wakeup_kswapd(*z, order);
956 } while (*(++z)); 956 } while (*(++z));
957 957
@@ -970,7 +970,8 @@ restart:
970 alloc_flags |= ALLOC_HARDER; 970 alloc_flags |= ALLOC_HARDER;
971 if (gfp_mask & __GFP_HIGH) 971 if (gfp_mask & __GFP_HIGH)
972 alloc_flags |= ALLOC_HIGH; 972 alloc_flags |= ALLOC_HIGH;
973 alloc_flags |= ALLOC_CPUSET; 973 if (wait)
974 alloc_flags |= ALLOC_CPUSET;
974 975
975 /* 976 /*
976 * Go through the zonelist again. Let __GFP_HIGH and allocations 977 * Go through the zonelist again. Let __GFP_HIGH and allocations
@@ -2124,14 +2125,22 @@ static void __init alloc_node_mem_map(struct pglist_data *pgdat)
2124#ifdef CONFIG_FLAT_NODE_MEM_MAP 2125#ifdef CONFIG_FLAT_NODE_MEM_MAP
2125 /* ia64 gets its own node_mem_map, before this, without bootmem */ 2126 /* ia64 gets its own node_mem_map, before this, without bootmem */
2126 if (!pgdat->node_mem_map) { 2127 if (!pgdat->node_mem_map) {
2127 unsigned long size; 2128 unsigned long size, start, end;
2128 struct page *map; 2129 struct page *map;
2129 2130
2130 size = (pgdat->node_spanned_pages + 1) * sizeof(struct page); 2131 /*
2132 * The zone's endpoints aren't required to be MAX_ORDER
2133 * aligned but the node_mem_map endpoints must be in order
2134 * for the buddy allocator to function correctly.
2135 */
2136 start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
2137 end = pgdat->node_start_pfn + pgdat->node_spanned_pages;
2138 end = ALIGN(end, MAX_ORDER_NR_PAGES);
2139 size = (end - start) * sizeof(struct page);
2131 map = alloc_remap(pgdat->node_id, size); 2140 map = alloc_remap(pgdat->node_id, size);
2132 if (!map) 2141 if (!map)
2133 map = alloc_bootmem_node(pgdat, size); 2142 map = alloc_bootmem_node(pgdat, size);
2134 pgdat->node_mem_map = map; 2143 pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);
2135 } 2144 }
2136#ifdef CONFIG_FLATMEM 2145#ifdef CONFIG_FLATMEM
2137 /* 2146 /*
diff --git a/mm/sparse.c b/mm/sparse.c
index c5e89eb9ac8f..100040c0dfb6 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -87,11 +87,8 @@ int __section_nr(struct mem_section* ms)
87 unsigned long root_nr; 87 unsigned long root_nr;
88 struct mem_section* root; 88 struct mem_section* root;
89 89
90 for (root_nr = 0; 90 for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
91 root_nr < NR_MEM_SECTIONS; 91 root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
92 root_nr += SECTIONS_PER_ROOT) {
93 root = __nr_to_section(root_nr);
94
95 if (!root) 92 if (!root)
96 continue; 93 continue;
97 94