Skip to contentSkip to conversation

memblock: Update nid info in memblock debugfs

PATCH Superseded Yuwei Guan 2 participants 3 messages May 29, 2023 – Jun 1, 2023

Subsystems (2)
lore
Share & tools
lore

Yuwei Guan

author
#0 lore raw

PATCH 1/1 memblock: Update nid info in memblock debugfs

The node id for memblock reserved regions will be wrong,
so let's show 'x' for reg->nid == MAX_NUMNODES in debugfs to keep it align.

---
 mm/memblock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/memblock.c +6 -2
index c5c80d9bcea3..3d449aaba052 100644
@@ -2169,17 +2169,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
 {
 	struct memblock_type *type = m->private;
 	struct memblock_region *reg;
-	int i, j;
+	int i, j, nid;
 	unsigned int count = ARRAY_SIZE(flagname);
 	phys_addr_t end;
 
 	for (i = 0; i < type->cnt; i++) {
 		reg = &type->regions[i];
 		end = reg->base + reg->size - 1;
+		nid = memblock_get_region_node(reg);
 
 		seq_printf(m, "%4d: ", i);
 		seq_printf(m, "%pa..%pa ", &reg->base, &end);
-		seq_printf(m, "%4d ", memblock_get_region_node(reg));
+		if (nid != MAX_NUMNODES)
+			seq_printf(m, "%4d ", nid);
+		else
+			seq_printf(m, "%4c ", 'x');
 		if (reg->flags) {
 			for (j = 0; j < count; j++) {
 				if (reg->flags & (1U << j)) {
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 6 lines · Yuwei Guan

The node id for memblock reserved regions will be wrong,
so let's show 'x' for reg->nid == MAX_NUMNODES in debugfs to keep it align.

I believe this could use Co-developed-by tags.
Please take a look at Documentation/process/submitting-patches.rst

Quoted 35 lines
---
 mm/memblock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/memblock.c +6 -2
index c5c80d9bcea3..3d449aaba052 100644
@@ -2169,17 +2169,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
 {
 	struct memblock_type *type = m->private;
 	struct memblock_region *reg;
-	int i, j;
+	int i, j, nid;
 	unsigned int count = ARRAY_SIZE(flagname);
 	phys_addr_t end;
 
 	for (i = 0; i < type->cnt; i++) {
 		reg = &type->regions[i];
 		end = reg->base + reg->size - 1;
+		nid = memblock_get_region_node(reg);
 
 		seq_printf(m, "%4d: ", i);
 		seq_printf(m, "%pa..%pa ", &reg->base, &end);
-		seq_printf(m, "%4d ", memblock_get_region_node(reg));
+		if (nid != MAX_NUMNODES)
+			seq_printf(m, "%4d ", nid);
+		else
+			seq_printf(m, "%4c ", 'x');
 		if (reg->flags) {
 			for (j = 0; j < count; j++) {
 				if (reg->flags & (1U << j)) {
Signature · 1 line
2.34.1
Signature · 2 lines
Sincerely yours,
Mike.
author
#2 lore raw
Quoted 5 lines · Mike Rapoport <[email protected]> 于2023年6月1日周四 13:21写道:
Quoted 3 lines · Yuwei Guan

The node id for memblock reserved regions will be wrong,
so let's show 'x' for reg->nid == MAX_NUMNODES in debugfs to keep it align.

Quoted 7 lines
Quoted 3 lines

I believe this could use Co-developed-by tags.
Please take a look at Documentation/process/submitting-patches.rst

Hi Mike,

Thanks, I will look into it, and resend this patch soon.

Quoted 39 lines
Quoted 33 lines
---
 mm/memblock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/memblock.c +6 -3
index c5c80d9bcea3..3d449aaba052 100644
@@ -2169,17 +2169,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
 {
      struct memblock_type *type = m->private;
      struct memblock_region *reg;
-     int i, j;
+     int i, j, nid;
      unsigned int count = ARRAY_SIZE(flagname);
      phys_addr_t end;
 
      for (i = 0; i < type->cnt; i++) {
              reg = &type->regions[i];
              end = reg->base + reg->size - 1;
+             nid = memblock_get_region_node(reg);
 
              seq_printf(m, "%4d: ", i);
              seq_printf(m, "%pa..%pa ", &reg->base, &end);
-             seq_printf(m, "%4d ", memblock_get_region_node(reg));
+             if (nid != MAX_NUMNODES)
+                     seq_printf(m, "%4d ", nid);
+             else
+                     seq_printf(m, "%4c ", 'x');
              if (reg->flags) {
                      for (j = 0; j < count; j++) {
                              if (reg->flags & (1U << j)) {
--
Quoted 2 lines

2.34.1

--
Sincerely yours,
Mike.