"__node_data" instead of "node_data" is used in the MIPS64 architecture,
so "__node_data" is used to replace "node_data" to improve the use of
next_online_pgdat() functions in the MIPS64 architecture.

E.g. Without this patch:
...
MEMORY: 0
...

With this patch:
...
MEMORY: 7.5 GB
...

Signed-off-by: Huacai Chen <chenhua...@loongson.cn>
Signed-off-by: Youling Tang <tangyoul...@loongson.cn>
---
v1 -> v2:
 - Add corresponding comments.

 memory.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/memory.c b/memory.c
index 33b0ca7..cea49da 100644
--- a/memory.c
+++ b/memory.c
@@ -17819,23 +17819,32 @@ next_online_pgdat(int node)
 {
         char buf[BUFSIZE];
        ulong pgdat;

+/*
+ * "__node_data" is used in the mips64 architecture,
+ * and "node_data" is used in other architectures.
+ */
+#ifndef __mips64
+#define NODE_DATA_VAR "node_data"
+#else
+#define NODE_DATA_VAR "__node_data"
+#endif
 
        /*
-        *  Default -- look for type: struct pglist_data node_data[]
+        *  Default -- look for type:  node_data[]/__node_data[]
         */
        if (LKCD_KERNTYPES()) {
-               if (!kernel_symbol_exists("node_data"))
+               if (!kernel_symbol_exists(NODE_DATA_VAR))
                        goto pgdat2;
                /* 
-                *  Just index into node_data[] without checking that it is
-                *  an array; kerntypes have no such symbol information.
+                *  Just index into node_data[]/__node_data[] without checking 
that
+                *  it is an array; kerntypes have no such symbol information.
                 */
        } else {
-               if (get_symbol_type("node_data", NULL, NULL) != TYPE_CODE_ARRAY)
+               if (get_symbol_type(NODE_DATA_VAR, NULL, NULL) != 
TYPE_CODE_ARRAY)
                        goto pgdat2;
 
                open_tmpfile();
-               sprintf(buf, "whatis node_data");
+               sprintf(buf, "whatis " NODE_DATA_VAR);
                if (!gdb_pass_through(buf, fp, GNU_RETURN_ON_ERROR)) {
                        close_tmpfile();
                        goto pgdat2;
@@ -17848,14 +17857,15 @@ next_online_pgdat(int node)
                close_tmpfile();
 
                if ((!strstr(buf, "struct pglist_data *") &&
-                    !strstr(buf, "pg_data_t *")) ||
+                    !strstr(buf, "pg_data_t *") &&
+                    !strstr(buf, "struct node_data *")) ||
                    (count_chars(buf, '[') != 1) ||
                    (count_chars(buf, ']') != 1))
                        goto pgdat2;
        }
 
-       if (!readmem(symbol_value("node_data") + (node * sizeof(void *)), 
-           KVADDR, &pgdat, sizeof(void *), "node_data", RETURN_ON_ERROR) ||
+       if (!readmem(symbol_value(NODE_DATA_VAR) + (node * sizeof(void *)),
+           KVADDR, &pgdat, sizeof(void *), NODE_DATA_VAR, RETURN_ON_ERROR) ||
            !IS_KVADDR(pgdat))
                goto pgdat2;
 
@@ -17883,7 +17893,8 @@ pgdat2:
                close_tmpfile();
 
                if ((!strstr(buf, "struct pglist_data *") &&
-                    !strstr(buf, "pg_data_t *")) ||
+                    !strstr(buf, "pg_data_t *") &&
+                    !strstr(buf, "struct node_data *")) ||
                    (count_chars(buf, '[') != 1) ||
                    (count_chars(buf, ']') != 1))
                        goto pgdat3;
-- 
2.1.0

--
Crash-utility mailing list
Crash-utility@redhat.com
https://listman.redhat.com/mailman/listinfo/crash-utility

Reply via email to