aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorMike Kravetz <kravetz@us.ibm.com>2005-12-16 17:30:35 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 23:14:22 -0500
commitb226e462124522f2f23153daff31c311729dfa2f (patch)
treec0cc2bbf0005098b348bdf25c84bff01cbd3beb6 /arch/powerpc/mm
parent021c73354921a315ae2fceb1ad7807d1569a5a74 (diff)
[PATCH] powerpc: don't add memory to empty node/zone
The system will oops if an attempt is made to add memory to an empty node/zone. This patch prevents adding memory to an empty node. The code to dynamically add a node/zone is non-trivial. This patch is temporary and will be removed when the ability to dynamically add a node/zone is complete. Signed-off-by: Mike Kravetz <kravetz@us.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm')
-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 */