diff options
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 477e183a4ac7..6a9ba14e18ed 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -250,7 +250,6 @@ static int __meminit __add_section(int nid, unsigned long phys_start_pfn, | |||
250 | struct vmem_altmap *altmap, bool want_memblock) | 250 | struct vmem_altmap *altmap, bool want_memblock) |
251 | { | 251 | { |
252 | int ret; | 252 | int ret; |
253 | int i; | ||
254 | 253 | ||
255 | if (pfn_valid(phys_start_pfn)) | 254 | if (pfn_valid(phys_start_pfn)) |
256 | return -EEXIST; | 255 | return -EEXIST; |
@@ -259,23 +258,6 @@ static int __meminit __add_section(int nid, unsigned long phys_start_pfn, | |||
259 | if (ret < 0) | 258 | if (ret < 0) |
260 | return ret; | 259 | return ret; |
261 | 260 | ||
262 | /* | ||
263 | * Make all the pages reserved so that nobody will stumble over half | ||
264 | * initialized state. | ||
265 | * FIXME: We also have to associate it with a node because page_to_nid | ||
266 | * relies on having page with the proper node. | ||
267 | */ | ||
268 | for (i = 0; i < PAGES_PER_SECTION; i++) { | ||
269 | unsigned long pfn = phys_start_pfn + i; | ||
270 | struct page *page; | ||
271 | if (!pfn_valid(pfn)) | ||
272 | continue; | ||
273 | |||
274 | page = pfn_to_page(pfn); | ||
275 | set_page_node(page, nid); | ||
276 | SetPageReserved(page); | ||
277 | } | ||
278 | |||
279 | if (!want_memblock) | 261 | if (!want_memblock) |
280 | return 0; | 262 | return 0; |
281 | 263 | ||
@@ -908,8 +890,15 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ | |||
908 | int nid; | 890 | int nid; |
909 | int ret; | 891 | int ret; |
910 | struct memory_notify arg; | 892 | struct memory_notify arg; |
893 | struct memory_block *mem; | ||
894 | |||
895 | /* | ||
896 | * We can't use pfn_to_nid() because nid might be stored in struct page | ||
897 | * which is not yet initialized. Instead, we find nid from memory block. | ||
898 | */ | ||
899 | mem = find_memory_block(__pfn_to_section(pfn)); | ||
900 | nid = mem->nid; | ||
911 | 901 | ||
912 | nid = pfn_to_nid(pfn); | ||
913 | /* associate pfn range with the zone */ | 902 | /* associate pfn range with the zone */ |
914 | zone = move_pfn_range(online_type, nid, pfn, nr_pages); | 903 | zone = move_pfn_range(online_type, nid, pfn, nr_pages); |
915 | 904 | ||