aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/node.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 560751bad294..ae98ebaf6313 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -390,7 +390,18 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
390 sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr); 390 sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
391 sect_end_pfn += PAGES_PER_SECTION - 1; 391 sect_end_pfn += PAGES_PER_SECTION - 1;
392 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { 392 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
393 int page_nid; 393 int page_nid, scn_nr;
394
395 /*
396 * memory block could have several absent sections from start.
397 * skip pfn range from absent section
398 */
399 scn_nr = pfn_to_section_nr(pfn);
400 if (!present_section_nr(scn_nr)) {
401 pfn = round_down(pfn + PAGES_PER_SECTION,
402 PAGES_PER_SECTION) - 1;
403 continue;
404 }
394 405
395 /* 406 /*
396 * memory block could have several absent sections from start. 407 * memory block could have several absent sections from start.
@@ -436,10 +447,22 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
436 return -ENOMEM; 447 return -ENOMEM;
437 nodes_clear(*unlinked_nodes); 448 nodes_clear(*unlinked_nodes);
438 449
439 sect_start_pfn = section_nr_to_pfn(phys_index); 450 sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
440 sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; 451 sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
452 sect_end_pfn += PAGES_PER_SECTION - 1;
441 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { 453 for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
442 int nid; 454 int nid, scn_nr;
455
456 /*
457 * memory block could have several absent sections from start.
458 * skip pfn range from absent section
459 */
460 scn_nr = pfn_to_section_nr(pfn);
461 if (!present_section_nr(scn_nr)) {
462 pfn = round_down(pfn + PAGES_PER_SECTION,
463 PAGES_PER_SECTION) - 1;
464 continue;
465 }
443 466
444 nid = get_nid_for_pfn(pfn); 467 nid = get_nid_for_pfn(pfn);
445 if (nid < 0) 468 if (nid < 0)