summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c3
-rw-r--r--mm/page_alloc.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 003dbe4b060d..6da82bcb0a8b 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1277,6 +1277,7 @@ int __ref add_memory(int nid, u64 start, u64 size)
1277 1277
1278 /* create new memmap entry */ 1278 /* create new memmap entry */
1279 firmware_map_add_hotplug(start, start + size, "System RAM"); 1279 firmware_map_add_hotplug(start, start + size, "System RAM");
1280 memblock_add_node(start, size, nid);
1280 1281
1281 goto out; 1282 goto out;
1282 1283
@@ -2013,6 +2014,8 @@ void __ref remove_memory(int nid, u64 start, u64 size)
2013 2014
2014 /* remove memmap entry */ 2015 /* remove memmap entry */
2015 firmware_map_remove(start, start + size, "System RAM"); 2016 firmware_map_remove(start, start + size, "System RAM");
2017 memblock_free(start, size);
2018 memblock_remove(start, size);
2016 2019
2017 arch_remove_memory(start, size); 2020 arch_remove_memory(start, size);
2018 2021
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index beda41710802..df959b7d6085 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5060,6 +5060,10 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid,
5060{ 5060{
5061 unsigned long zone_start_pfn, zone_end_pfn; 5061 unsigned long zone_start_pfn, zone_end_pfn;
5062 5062
5063 /* When hotadd a new node, the node should be empty */
5064 if (!node_start_pfn && !node_end_pfn)
5065 return 0;
5066
5063 /* Get the start and end of the zone */ 5067 /* Get the start and end of the zone */
5064 zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; 5068 zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type];
5065 zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; 5069 zone_end_pfn = arch_zone_highest_possible_pfn[zone_type];
@@ -5123,6 +5127,10 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
5123 unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; 5127 unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
5124 unsigned long zone_start_pfn, zone_end_pfn; 5128 unsigned long zone_start_pfn, zone_end_pfn;
5125 5129
5130 /* When hotadd a new node, the node should be empty */
5131 if (!node_start_pfn && !node_end_pfn)
5132 return 0;
5133
5126 zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); 5134 zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high);
5127 zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); 5135 zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high);
5128 5136