Commit b226e462 authored by Mike Kravetz's avatar Mike Kravetz Committed by Paul Mackerras

[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: default avatarMike Kravetz <kravetz@us.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 021c7335
...@@ -766,13 +766,15 @@ early_param("numa", early_numa); ...@@ -766,13 +766,15 @@ early_param("numa", early_numa);
int hot_add_scn_to_nid(unsigned long scn_addr) int hot_add_scn_to_nid(unsigned long scn_addr)
{ {
struct device_node *memory = NULL; struct device_node *memory = NULL;
nodemask_t nodes;
int numa_domain = 0;
if (!numa_enabled || (min_common_depth < 0)) if (!numa_enabled || (min_common_depth < 0))
return 0; return numa_domain;
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start, size; unsigned long start, size;
int numa_domain, ranges; int ranges;
unsigned int *memcell_buf; unsigned int *memcell_buf;
unsigned int len; unsigned int len;
...@@ -793,14 +795,21 @@ int hot_add_scn_to_nid(unsigned long scn_addr) ...@@ -793,14 +795,21 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
if ((scn_addr >= start) && (scn_addr < (start + size))) { if ((scn_addr >= start) && (scn_addr < (start + size))) {
of_node_put(memory); of_node_put(memory);
return numa_domain; goto got_numa_domain;
} }
if (--ranges) /* process all ranges in cell */ if (--ranges) /* process all ranges in cell */
goto ha_new_range; goto ha_new_range;
} }
BUG(); /* section address should be found above */ BUG(); /* section address should be found above */
return 0;
/* Temporary code to ensure that returned node is not empty */
got_numa_domain:
nodes_setall(nodes);
while (NODE_DATA(numa_domain)->node_spanned_pages == 0) {
node_clear(numa_domain, nodes);
numa_domain = any_online_node(nodes);
}
return numa_domain;
} }
#endif /* CONFIG_MEMORY_HOTPLUG */ #endif /* CONFIG_MEMORY_HOTPLUG */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment