• Roman Gushchin's avatar
    tools/cgroup: add memcg_slabinfo.py tool · fbc1ac9d
    Roman Gushchin authored
    Add a drgn-based tool to display slab information for a given memcg.  Can
    replace cgroup v1 memory.kmem.slabinfo interface on cgroup v2, but in a
    more flexiable way.
    
    Currently supports only SLUB configuration, but SLAB can be trivially
    added later.
    
    Output example:
    $ sudo ./tools/cgroup/memcg_slabinfo.py /sys/fs/cgroup/user.slice/user-111017.slice/user\@111017.service
    shmem_inode_cache     92     92    704   46    8 : tunables    0    0    0 : slabdata      2      2      0
    eventpoll_pwq         56     56     72   56    1 : tunables    0    0    0 : slabdata      1      1      0
    eventpoll_epi         32     32    128   32    1 : tunables    0    0    0 : slabdata      1      1      0
    kmalloc-8              0      0      8  512    1 : tunables    0    0    0 : slabdata      0      0      0
    kmalloc-96             0      0     96   42    1 : tunables    0    0    0 : slabdata      0      0      0
    kmalloc-2048           0      0   2048   16    8 : tunables    0    0    0 : slabdata      0      0      0
    kmalloc-64           128    128     64   64    1 : tunables    0    0    0 : slabdata      2      2      0
    mm_struct            160    160   1024   32    8 : tunables    0    0    0 : slabdata      5      5      0
    signal_cache          96     96   1024   32    8 : tunables    0    0    0 : slabdata      3      3      0
    sighand_cache         45     45   2112   15    8 : tunables    0    0    0 : slabdata      3      3      0
    files_cache          138    138    704   46    8 : tunables    0    0    0 : slabdata      3      3      0
    task_delay_info      153    153     80   51    1 : tunables    0    0    0 : slabdata      3      3      0
    task_struct           27     27   3520    9    8 : tunables    0    0    0 : slabdata      3      3      0
    radix_tree_node       56     56    584   28    4 : tunables    0    0    0 : slabdata      2      2      0
    btrfs_inode          140    140   1136   28    8 : tunables    0    0    0 : slabdata      5      5      0
    kmalloc-1024          64     64   1024   32    8 : tunables    0    0    0 : slabdata      2      2      0
    kmalloc-192           84     84    192   42    2 : tunables    0    0    0 : slabdata      2      2      0
    inode_cache           54     54    600   27    4 : tunables    0    0    0 : slabdata      2      2      0
    kmalloc-128            0      0    128   32    1 : tunables    0    0    0 : slabdata      0      0      0
    kmalloc-512           32     32    512   32    4 : tunables    0    0    0 : slabdata      1      1      0
    skbuff_head_cache     32     32    256   32    2 : tunables    0    0    0 : slabdata      1      1      0
    sock_inode_cache      46     46    704   46    8 : tunables    0    0    0 : slabdata      1      1      0
    cred_jar             378    378    192   42    2 : tunables    0    0    0 : slabdata      9      9      0
    proc_inode_cache      96     96    672   24    4 : tunables    0    0    0 : slabdata      4      4      0
    dentry               336    336    192   42    2 : tunables    0    0    0 : slabdata      8      8      0
    filp                 697    864    256   32    2 : tunables    0    0    0 : slabdata     27     27      0
    anon_vma             644    644     88   46    1 : tunables    0    0    0 : slabdata     14     14      0
    pid                 1408   1408     64   64    1 : tunables    0    0    0 : slabdata     22     22      0
    vm_area_struct      1200   1200    200   40    2 : tunables    0    0    0 : slabdata     30     30      0
    Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Acked-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Shakeel Butt <shakeelb@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Link: http://lkml.kernel.org/r/20200623174037.3951353-20-guro@fb.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    fbc1ac9d
memcg_slabinfo.py 6.46 KB