mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Online memory-only NUMA nodes
@ 2026-11-17 17:29 Sang-Heon Jeon
  0 siblings, 0 replies; only message in thread
From: Sang-Heon Jeon @ 2026-11-17 17:29 UTC (permalink / raw)
  To: Huacai Chen; +Cc: linux-kernel, loongarch, WANG Xuerui, stable

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@vger.kernel.org
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-17 17:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 17:29 [PATCH] LoongArch: Online memory-only NUMA nodes Sang-Heon Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®