Skip to contentSkip to conversation

LoongArch: Online memory-only NUMA nodes

PATCH New Sang-Heon Jeon 1 participant 1 message Nov 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LoongArch: Online memory-only NUMA nodes

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")
---
 arch/loongarch/kernel/numa.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/loongarch/kernel/numa.c +8 -5
index 7dedc134ddfe..595cc15203a3 100644
@@ -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

Signature · 1 line
2.53.0