aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/srat_32.c2
-rw-r--r--arch/x86/mm/srat_64.c4
-rw-r--r--include/linux/mm.h3
-rw-r--r--mm/page_alloc.c4
4 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c
index 6f8aa33031c7..9324f13492d5 100644
--- a/arch/x86/mm/srat_32.c
+++ b/arch/x86/mm/srat_32.c
@@ -267,6 +267,8 @@ int __init get_memcfg_from_srat(void)
267 e820_register_active_regions(chunk->nid, chunk->start_pfn, 267 e820_register_active_regions(chunk->nid, chunk->start_pfn,
268 min(chunk->end_pfn, max_pfn)); 268 min(chunk->end_pfn, max_pfn));
269 } 269 }
270 /* for out of order entries in SRAT */
271 sort_node_map();
270 272
271 for_each_online_node(nid) { 273 for_each_online_node(nid) {
272 unsigned long start = node_start_pfn[nid]; 274 unsigned long start = node_start_pfn[nid];
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index d89075489664..a27124185fc1 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -317,7 +317,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes)
317 unsigned long s = nodes[i].start >> PAGE_SHIFT; 317 unsigned long s = nodes[i].start >> PAGE_SHIFT;
318 unsigned long e = nodes[i].end >> PAGE_SHIFT; 318 unsigned long e = nodes[i].end >> PAGE_SHIFT;
319 pxmram += e - s; 319 pxmram += e - s;
320 pxmram -= absent_pages_in_range(s, e); 320 pxmram -= __absent_pages_in_range(i, s, e);
321 if ((long)pxmram < 0) 321 if ((long)pxmram < 0)
322 pxmram = 0; 322 pxmram = 0;
323 } 323 }
@@ -373,6 +373,8 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
373 for_each_node_mask(i, nodes_parsed) 373 for_each_node_mask(i, nodes_parsed)
374 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, 374 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
375 nodes[i].end >> PAGE_SHIFT); 375 nodes[i].end >> PAGE_SHIFT);
376 /* for out of order entries in SRAT */
377 sort_node_map();
376 if (!nodes_cover_memory(nodes)) { 378 if (!nodes_cover_memory(nodes)) {
377 bad_srat(); 379 bad_srat();
378 return -1; 380 return -1;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 24c395694f4d..20a2036f3a94 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1022,6 +1022,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1022extern void remove_active_range(unsigned int nid, unsigned long start_pfn, 1022extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1023 unsigned long end_pfn); 1023 unsigned long end_pfn);
1024extern void remove_all_active_ranges(void); 1024extern void remove_all_active_ranges(void);
1025void sort_node_map(void);
1026unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1027 unsigned long end_pfn);
1025extern unsigned long absent_pages_in_range(unsigned long start_pfn, 1028extern unsigned long absent_pages_in_range(unsigned long start_pfn,
1026 unsigned long end_pfn); 1029 unsigned long end_pfn);
1027extern void get_pfn_range_for_nid(unsigned int nid, 1030extern void get_pfn_range_for_nid(unsigned int nid,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2bc2ac63f41e..873c86308b4e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3573,7 +3573,7 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid,
3573 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES, 3573 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES,
3574 * then all holes in the requested range will be accounted for. 3574 * then all holes in the requested range will be accounted for.
3575 */ 3575 */
3576static unsigned long __meminit __absent_pages_in_range(int nid, 3576unsigned long __meminit __absent_pages_in_range(int nid,
3577 unsigned long range_start_pfn, 3577 unsigned long range_start_pfn,
3578 unsigned long range_end_pfn) 3578 unsigned long range_end_pfn)
3579{ 3579{
@@ -4102,7 +4102,7 @@ static int __init cmp_node_active_region(const void *a, const void *b)
4102} 4102}
4103 4103
4104/* sort the node_map by start_pfn */ 4104/* sort the node_map by start_pfn */
4105static void __init sort_node_map(void) 4105void __init sort_node_map(void)
4106{ 4106{
4107 sort(early_node_map, (size_t)nr_nodemap_entries, 4107 sort(early_node_map, (size_t)nr_nodemap_entries,
4108 sizeof(struct node_active_region), 4108 sizeof(struct node_active_region),