Nowadays, "kmem -s" output can have long lines due to cache name with
memcg name, and I don't think that it's human-readable as it is.
crash> kmem -s
CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE
ffff8a1522c15380 kmalloc-128(12536:session-11.scope) 128 111 128 4 4k
ffff8a1522c15200 radix_tree_node(12536:session-11.scope) 576 340 434 31
8k
ffff8a1523d15380 xfs_inode(12536:session-11.scope) 904 1567 1581 93 16k
ffff8a1522c15080 nfs_inode_cache(12536:session-11.scope) 1072 140 165 11
16k
ffff8a1523d14c00 shmem_inode_cache(12536:session-11.scope) 696 0 46 2
16k
So, can we move the 'NAME' column to the last of line like this?
crash> kmem -s
CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
ffff8a1522c15380 128 111 128 4 4k
kmalloc-128(12536:session-11.scope)
ffff8a1522c15200 576 340 434 31 8k
radix_tree_node(12536:session-11.scope)
ffff8a1523d15380 904 1567 1581 93 16k
xfs_inode(12536:session-11.scope)
ffff8a1522c15080 1072 140 165 11 16k
nfs_inode_cache(12536:session-11.scope)
ffff8a1523d14c00 696 0 46 2 16k
shmem_inode_cache(12536:session-11.scope)
If we can, crash has the three functions to print them for each slab/slub
version and I think that it would be good to change all of them together.
Fortunately, the header is same among them, and it looks like we can unify
them into one function. [Patch 1]
And then, move it to the last of line. [Patch 2]
I tested this with some vmcores having PERCPU_KMALLOC_V2 or KMALLOC_SLUB
and found no problem, but I don't have any vmcores having PERCPU_KMALLOC_V1
or no flag.
Kazuhito Hagio (2):
Unify the three functions printing "kmem -s" line into one function
Move NAME column in "kmem -s" output to the last of line
help.c | 136 +++++++++++++++++++++++++++++++--------------------------------
memory.c | 132 +++++++++++++++----------------------------------------------
2 files changed, 99 insertions(+), 169 deletions(-)
--
1.8.3.1