[PATCH] LoongArch: Online memory-only NUMA nodes

From: Sang-Heon Jeon

Date: Tue Nov 17 2026 - 12:29:42 EST


init_numa_memory() does not online a memory-only node, because it
onlines a node only if it has CPUs.

So online a node if it has any memory or CPUs.

Fixes: 87c6d144bc7b ("LoongArch: Don't init & online empty nodes")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Sang-Heon Jeon <ekffu200098@xxxxxxxxx>
---
arch/loongarch/kernel/numa.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.c
index 7dedc134ddfe..595cc15203a3 100644
--- a/arch/loongarch/kernel/numa.c
+++ b/arch/loongarch/kernel/numa.c
@@ -140,20 +140,25 @@ void numa_remove_cpu(unsigned int cpu)
cpumask_clear_cpu(cpu, &cpus_on_node[nid]);
}

-static void __init node_mem_init(unsigned int node)
+static bool __init node_mem_init(unsigned int node)
{
unsigned long start_pfn, end_pfn;
unsigned long node_addrspace_offset;

+ get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
+ if (start_pfn == end_pfn)
+ return false;
+
node_addrspace_offset = nid_to_addrbase(node);
pr_info("Node%d's addrspace_offset is 0x%lx\n",
node, node_addrspace_offset);

- get_pfn_range_for_nid(node, &start_pfn, &end_pfn);
pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx\n",
node, start_pfn, end_pfn);

alloc_node_data(node);
+
+ return true;
}

#ifdef CONFIG_ACPI_NUMA
@@ -246,10 +251,8 @@ int __init init_numa_memory(void)
return -EINVAL;

for_each_node_mask(node, node_possible_map) {
- if (!cpumask_empty(&cpus_on_node[node])) {
- node_mem_init(node);
+ if (node_mem_init(node) || !cpumask_empty(&cpus_on_node[node]))
node_set_online(node);
- }
}
max_pfn = PFN_DOWN(memblock_end_of_DRAM());
max_low_pfn = min(PFN_DOWN(HIGHMEM_START), max_pfn);

base-commit: 422e532809572ba1043192bf6a0c653bc68b3140
--
2.53.0