linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memblock: update numa node of memblk reserved type
@ 2023-05-23 11:57 Kefeng Wang
  2023-05-24  4:59 ` Anshuman Khandual
  0 siblings, 1 reply; 5+ messages in thread
From: Kefeng Wang @ 2023-05-23 11:57 UTC (permalink / raw)
  To: Mike Rapoport, Andrew Morton, linux-mm
  Cc: linux-kernel, tsahu, anshuman.khandual, ssawgyw, Kefeng Wang

The numa node of memblk reserved type is wrong, it could update
according to the numa node information from memblk memory type,
let's fix it.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/memblock.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/mm/memblock.c b/mm/memblock.c
index a50447d970ef..45a0781cda31 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1922,6 +1922,28 @@ phys_addr_t __init_memblock memblock_get_current_limit(void)
 	return memblock.current_limit;
 }
 
+static void __init_memblock memblock_reserved_update_node(void)
+{
+	struct memblock_region *rgn;
+	phys_addr_t base, end, size;
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_NUMA))
+		return;
+
+	for_each_mem_region(rgn) {
+		base = rgn->base;
+		size = rgn->size;
+		end = base + size - 1;
+
+		ret = memblock_set_node(base, size, &memblock.reserved,
+					memblock_get_region_node(rgn));
+		if (ret)
+			pr_err("memblock: Failed to update reserved [%pa-%pa] node",
+			       &base, &end);
+	}
+}
+
 static void __init_memblock memblock_dump(struct memblock_type *type)
 {
 	phys_addr_t base, end, size;
@@ -1955,6 +1977,7 @@ static void __init_memblock __memblock_dump_all(void)
 		&memblock.memory.total_size,
 		&memblock.reserved.total_size);
 
+	memblock_reserved_update_node();
 	memblock_dump(&memblock.memory);
 	memblock_dump(&memblock.reserved);
 #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
@@ -2196,6 +2219,8 @@ static int memblock_debug_show(struct seq_file *m, void *private)
 	unsigned int count = ARRAY_SIZE(flagname);
 	phys_addr_t end;
 
+	memblock_reserved_update_node();
+
 	for (i = 0; i < type->cnt; i++) {
 		reg = &type->regions[i];
 		end = reg->base + reg->size - 1;
-- 
2.35.3



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-25  1:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 11:57 [PATCH] memblock: update numa node of memblk reserved type Kefeng Wang
2023-05-24  4:59 ` Anshuman Khandual
2023-05-24  6:47   ` Kefeng Wang
2023-05-24 15:33     ` Mike Rapoport
2023-05-25  1:28       ` Kefeng Wang

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