Currently fallback nodes for offline nodes aren't set. Hence by default
node 0 ends up being the default node. However node 0 might be offline.

Fix this by explicitly setting fallback node. Ensure first_memory_node
is set before kernel does explicit setting of fallback node.

Cc: Andrew Morton <a...@linux-foundation.org>
Cc: linux...@kvack.org
Cc: Mel Gorman <mgor...@suse.de>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: Sachin Sant <sach...@linux.vnet.ibm.com>
Cc: Michal Hocko <mho...@kernel.org>
Cc: Christopher Lameter <c...@linux.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Joonsoo Kim <iamjoonsoo....@lge.com>
Cc: Kirill Tkhai <ktk...@virtuozzo.com>
Cc: Vlastimil Babka <vba...@suse.cz>
Cc: Srikar Dronamraju <sri...@linux.vnet.ibm.com>
Cc: Bharata B Rao <bhar...@linux.ibm.com>

Reported-by: Sachin Sant <sach...@linux.vnet.ibm.com>
Tested-by: Sachin Sant <sach...@linux.vnet.ibm.com>
Signed-off-by: Srikar Dronamraju <sri...@linux.vnet.ibm.com>
---
 arch/powerpc/mm/numa.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 281531340230..6e97ab6575cb 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -827,7 +827,16 @@ void __init dump_numa_cpu_topology(void)
        if (!numa_enabled)
                return;
 
-       for_each_online_node(node) {
+       for_each_node(node) {
+               /*
+                * For all possible but not yet online nodes, ensure their
+                * node_numa_mem is set correctly so that kmalloc_node works
+                * for such nodes.
+                */
+               if (!node_online(node)) {
+                       reset_numa_mem(node);
+                       continue;
+               }
                pr_info("Node %d CPUs:", node);
 
                count = 0;
-- 
2.18.1

Reply via email to