help -k will display total number of cpus. This patch skips offline
cpu and only calculates online cpus' number.

The original output is like below:
<cut>
crash> help -k
...
          cpus: 4
...
<cut>

With data of offline cpu(cpu #2) hiden, the output like below:
<cut>
crash> help -k
...
          cpus: 3
...
<cut>

Signed-off-by: Qiao Nuohan <[email protected]>
---
 kernel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel.c b/kernel.c
index 8f34a3e..f5bf011 100755
--- a/kernel.c
+++ b/kernel.c
@@ -5243,7 +5243,7 @@ dump_kernel_table(int verbose)
         fprintf(fp, "    init_begin: %lx\n", kt->init_begin);
         fprintf(fp, "      init_end: %lx\n", kt->init_end);
         fprintf(fp, "           end: %lx\n", kt->end);
-        fprintf(fp, "          cpus: %d\n", kt->cpus);
+        fprintf(fp, "          cpus: %d\n", get_cpus_to_display());
         fprintf(fp, " cpus_override: %s\n", kt->cpus_override);
         fprintf(fp, "       NR_CPUS: %d (compiled-in to this version of %s)\n",
                NR_CPUS, pc->program_name); 
-- 
1.8.5.3

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to