diff options
Diffstat (limited to 'arch/ppc64/mm/numa.c')
-rw-r--r-- | arch/ppc64/mm/numa.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c index c3116f0d788c..cb864b8f2750 100644 --- a/arch/ppc64/mm/numa.c +++ b/arch/ppc64/mm/numa.c | |||
@@ -440,8 +440,6 @@ new_range: | |||
440 | for (i = start ; i < (start+size); i += MEMORY_INCREMENT) | 440 | for (i = start ; i < (start+size); i += MEMORY_INCREMENT) |
441 | numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = | 441 | numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = |
442 | numa_domain; | 442 | numa_domain; |
443 | memory_present(numa_domain, start >> PAGE_SHIFT, | ||
444 | (start + size) >> PAGE_SHIFT); | ||
445 | 443 | ||
446 | if (--ranges) | 444 | if (--ranges) |
447 | goto new_range; | 445 | goto new_range; |
@@ -483,7 +481,6 @@ static void __init setup_nonnuma(void) | |||
483 | 481 | ||
484 | for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) | 482 | for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) |
485 | numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; | 483 | numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; |
486 | memory_present(0, 0, init_node_data[0].node_end_pfn); | ||
487 | } | 484 | } |
488 | 485 | ||
489 | static void __init dump_numa_topology(void) | 486 | static void __init dump_numa_topology(void) |
@@ -695,6 +692,46 @@ new_range: | |||
695 | size); | 692 | size); |
696 | } | 693 | } |
697 | } | 694 | } |
695 | /* | ||
696 | * This loop may look famaliar, but we have to do it again | ||
697 | * after marking our reserved memory to mark memory present | ||
698 | * for sparsemem. | ||
699 | */ | ||
700 | addr_cells = get_mem_addr_cells(); | ||
701 | size_cells = get_mem_size_cells(); | ||
702 | memory = NULL; | ||
703 | while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { | ||
704 | unsigned long mem_start, mem_size; | ||
705 | int numa_domain, ranges; | ||
706 | unsigned int *memcell_buf; | ||
707 | unsigned int len; | ||
708 | |||
709 | memcell_buf = (unsigned int *)get_property(memory, "reg", &len); | ||
710 | if (!memcell_buf || len <= 0) | ||
711 | continue; | ||
712 | |||
713 | ranges = memory->n_addrs; /* ranges in cell */ | ||
714 | new_range2: | ||
715 | mem_start = read_n_cells(addr_cells, &memcell_buf); | ||
716 | mem_size = read_n_cells(size_cells, &memcell_buf); | ||
717 | if (numa_enabled) { | ||
718 | numa_domain = of_node_numa_domain(memory); | ||
719 | if (numa_domain >= MAX_NUMNODES) | ||
720 | numa_domain = 0; | ||
721 | } else | ||
722 | numa_domain = 0; | ||
723 | |||
724 | if (numa_domain != nid) | ||
725 | continue; | ||
726 | |||
727 | mem_size = numa_enforce_memory_limit(mem_start, mem_size); | ||
728 | memory_present(numa_domain, mem_start >> PAGE_SHIFT, | ||
729 | (mem_start + mem_size) >> PAGE_SHIFT); | ||
730 | |||
731 | if (--ranges) /* process all ranges in cell */ | ||
732 | goto new_range2; | ||
733 | } | ||
734 | |||
698 | } | 735 | } |
699 | } | 736 | } |
700 | 737 | ||