aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/mm/numa.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index fc6f8ee9656f..2863a912bcd0 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -766,13 +766,15 @@ early_param("numa", early_numa);
766int hot_add_scn_to_nid(unsigned long scn_addr) 766int hot_add_scn_to_nid(unsigned long scn_addr)
767{ 767{
768 struct device_node *memory = NULL; 768 struct device_node *memory = NULL;
769 nodemask_t nodes;
770 int numa_domain = 0;
769 771
770 if (!numa_enabled || (min_common_depth < 0)) 772 if (!numa_enabled || (min_common_depth < 0))
771 return 0; 773 return numa_domain;
772 774
773 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 775 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
774 unsigned long start, size; 776 unsigned long start, size;
775 int numa_domain, ranges; 777 int ranges;
776 unsigned int *memcell_buf; 778 unsigned int *memcell_buf;
777 unsigned int len; 779 unsigned int len;
778 780
@@ -793,14 +795,21 @@ ha_new_range:
793 795
794 if ((scn_addr >= start) && (scn_addr < (start + size))) { 796 if ((scn_addr >= start) && (scn_addr < (start + size))) {
795 of_node_put(memory); 797 of_node_put(memory);
796 return numa_domain; 798 goto got_numa_domain;
797 } 799 }
798 800
799 if (--ranges) /* process all ranges in cell */ 801 if (--ranges) /* process all ranges in cell */
800 goto ha_new_range; 802 goto ha_new_range;
801 } 803 }
802
803 BUG(); /* section address should be found above */ 804 BUG(); /* section address should be found above */
804 return 0; 805
806 /* Temporary code to ensure that returned node is not empty */
807got_numa_domain:
808 nodes_setall(nodes);
809 while (NODE_DATA(numa_domain)->node_spanned_pages == 0) {
810 node_clear(numa_domain, nodes);
811 numa_domain = any_online_node(nodes);
812 }
813 return numa_domain;
805} 814}
806#endif /* CONFIG_MEMORY_HOTPLUG */ 815#endif /* CONFIG_MEMORY_HOTPLUG */