[PATCH v2 19/25] modify kmem -S(SLUB) to hide offline cpus' data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if SLUB is configured, kmem -S will display per-cpu data. This patch
will hide data of offline cpu.

The original output is like below:
<cut>
crash> kmem -S
...
CPU 1 KMEM_CACHE_CPU:
  ffff88003fc97360
CPU 1 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000dc0d40  ffff880037035000     0     16         11     5
  FREE / [ALLOCATED]
  [ffff880037035000]
  [ffff880037035100]
...
  [ffff88003c6e0f00]
CPU 2 KMEM_CACHE_CPU:
  ffff88003fd17360
CPU 2 SLAB:
  (empty)
CPU 2 PARTIAL:
  (empty)
CPU 3 KMEM_CACHE_CPU:
  ffff88003fd97360
CPU 3 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000ed8f80  ffff88003b63e000     0     16         13     3
  FREE / [ALLOCATED]
  [ffff88003b63e000]
...
<cut>

With data of offline cpu(cpu #2) hiden, the output is like below:
<cut>
crash> kmem -S
...
CPU 1 KMEM_CACHE_CPU:
  ffff88003fc97360
CPU 1 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000dc0d40  ffff880037035000     0     16         11     5
  FREE / [ALLOCATED]
  [ffff880037035000]
  [ffff880037035100]
...
  [ffff88003c6e0f00]
CPU 2 <OFFLINE>
CPU 3 KMEM_CACHE_CPU:
  ffff88003fd97360
CPU 3 SLAB:
  SLAB              MEMORY            NODE  TOTAL  ALLOCATED  FREE
  ffffea0000ed8f80  ffff88003b63e000     0     16         13     3
  FREE / [ALLOCATED]
  [ffff88003b63e000]
...
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx>
---
 memory.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/memory.c b/memory.c
index 6b7289b..10fa273 100755
--- a/memory.c
+++ b/memory.c
@@ -17466,6 +17466,11 @@ do_kmem_cache_slub(struct meminfo *si)
 	per_cpu = (ulong *)GETBUF(sizeof(ulong) * vt->numnodes);
 
         for (i = 0; i < kt->cpus; i++) {
+		if (hide_offline_cpu(i)) {
+			fprintf(fp, "CPU %d <OFFLINE>\n", i);
+			continue;
+		}
+
 		cpu_slab_ptr = ULONG(si->cache_buf + OFFSET(kmem_cache_cpu_slab)) +
 				kt->__per_cpu_offset[i];
 		fprintf(fp, "CPU %d KMEM_CACHE_CPU:\n  %lx\n", i, cpu_slab_ptr);
-- 
1.8.5.3

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




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux