From: Daniel Yeisley It is possible to boot a Unisys ES7000 with CPUs from multiple cells, and not also include the memory from those cells. This can create a scenario where node 0 has cpus, but no associated memory. The system will boot fine in a configuration where node 0 has memory, but nodes 2 and 3 do not. [AK: I rechecked the code and generic code seems to indeed handle that already. Dan's original patch had a change for mm/slab.c that seems to be already in now.] Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton --- arch/x86_64/kernel/pci-dma.c | 4 ++++ arch/x86_64/kernel/setup.c | 2 +- arch/x86_64/mm/srat.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff -puN arch/x86_64/kernel/pci-dma.c~x86_64-handle-empty-node-zero arch/x86_64/kernel/pci-dma.c --- devel/arch/x86_64/kernel/pci-dma.c~x86_64-handle-empty-node-zero 2006-05-29 14:16:22.000000000 -0700 +++ devel-akpm/arch/x86_64/kernel/pci-dma.c 2006-05-29 14:16:22.000000000 -0700 @@ -54,6 +54,10 @@ dma_alloc_pages(struct device *dev, gfp_ else #endif node = numa_node_id(); + + if (node < first_node(node_online_map)) + node = first_node(node_online_map); + page = alloc_pages_node(node, gfp, order); return page ? page_address(page) : NULL; } diff -puN arch/x86_64/kernel/setup.c~x86_64-handle-empty-node-zero arch/x86_64/kernel/setup.c --- devel/arch/x86_64/kernel/setup.c~x86_64-handle-empty-node-zero 2006-05-29 14:16:22.000000000 -0700 +++ devel-akpm/arch/x86_64/kernel/setup.c 2006-05-29 14:16:22.000000000 -0700 @@ -1051,7 +1051,7 @@ static void srat_detect_node(void) for now. */ node = apicid_to_node[hard_smp_processor_id()]; if (node == NUMA_NO_NODE) - node = 0; + node = first_node(node_online_map); numa_set_node(cpu, node); if (acpi_numa > 0) diff -puN arch/x86_64/mm/srat.c~x86_64-handle-empty-node-zero arch/x86_64/mm/srat.c --- devel/arch/x86_64/mm/srat.c~x86_64-handle-empty-node-zero 2006-05-29 14:16:22.000000000 -0700 +++ devel-akpm/arch/x86_64/mm/srat.c 2006-05-29 14:16:22.000000000 -0700 @@ -399,8 +399,10 @@ int __init acpi_scan_nodes(unsigned long /* First clean up the node list */ for (i = 0; i < MAX_NUMNODES; i++) { cutoff_node(i, start, end); - if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) + if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) { unparse_node(i); + node_set_offline(i); + } } if (acpi_numa <= 0) _