[Crash-utility] wrong values shown by kmem -s

Dave Anderson anderson at redhat.com
Thu Mar 10 19:03:45 UTC 2016



----- Original Message -----
> Hi,
> 
> With a ramdump of a system with 386MB of available memory, "kmem -s"
> shows something like this
> 
>     CACHE       NAME                 OBJSIZE  ALLOCATED     TOTAL  SLABS
>     SSIZE
>     dd801c00 kmalloc-2048            2048     670869         670960
> 41935    32k
> 
> The memory occupied by objects go beyond the total system memory if we
> use the above numbers to calculate that. I think the output is wrong
> because with SLUB, slabs can be of different sizes depending on the
> order of allocation. And here objects are calculated considering slabs
> are of fixed size.
> 
> The attached patch worked for me.
> 
> Thanks,
> Vinayak
> 

Something's not adding up, literally, when I compare the old values
with those shown by your patch.

For examples, without your patch, check just the caches with a single slab page, 
like the nfs_commit_data, fuse_inode and bio-2 caches:

  crash> kmem -s
  CACHE            NAME                 OBJSIZE  ALLOCATED     TOTAL  SLABS  SSIZE
  ffff880467c36300 nf_conntrack_ffff880065dd8000 312     0         0      0     8k
  ffff88046751f900 nf_conntrack_ffff880465411200 312     0         0      0     8k
  ffff8804608db000 nfs_direct_cache         352          0         0      0     8k
  ffff8804608daf00 nfs_commit_data          680         23        23      1    16k <=
  ffff8804608dae00 nfs_read_data            872        447       576     16    32k
  ffff8804608dad00 nfs_inode_cache         1048       1315      1364     44    32k
  ffff8804608dac00 fscache_cookie_jar        80        256       276      6     4k
  ffff88040b958000 fuse_inode               728         21        21      1    16k <=
  ffff88046751f800 btrfs_delayed_data_ref    96          0         0      0     4k
  ffff88046751f700 btrfs_delayed_ref_head   160          0         0      0     4k
  ffff88046751f600 btrfs_delayed_node       304          0         0      0     8k
  ffff88046751f500 btrfs_ordered_extent     424          0         0      0    16k
  ffff88046751f400 bio-2                    320         25        25      1     8k <=
  ...
  
Taking their respective object sizes into account:

  nfs_commit_data has an object size of 680, and the 16k slab can hold 23 objects:  
    23 * 680 = 15640

  fuse_inode has an object size of 728, and the 16k slab can hold 21 objects:
    21 * 728 = 15288

  bio-2 has an object size of 320, and the 8k slab can hold 25 objects:
    25 * 320 = 8000

With your patch applied, note that those caches show double the number above, or
46, 42 and 50 respectively:

  crash> kmem -s
  CACHE            NAME                 OBJSIZE  ALLOCATED     TOTAL  SLABS  SSIZE
  ffff880467c36300 nf_conntrack_ffff880065dd8000 312     0         0      0     8k
  ffff88046751f900 nf_conntrack_ffff880465411200 312     0         0      0     8k
  ffff8804608db000 nfs_direct_cache         352          0         0      0     8k
  ffff8804608daf00 nfs_commit_data          680         46        46      1    16k
  ffff8804608dae00 nfs_read_data            872        684       724     15    32k
  ffff8804608dad00 nfs_inode_cache         1048       1534      1534     43    32k
  ffff8804608dac00 fscache_cookie_jar        80        532       532      6     4k
  ffff88040b958000 fuse_inode               728         42        42      1    16k
  ffff88046751f800 btrfs_delayed_data_ref    96          0         0      0     4k
  ffff88046751f700 btrfs_delayed_ref_head   160          0         0      0     4k
  ffff88046751f600 btrfs_delayed_node       304          0         0      0     8k
  ffff88046751f500 btrfs_ordered_extent     424          0         0      0    16k
  ffff88046751f400 bio-2                    320         50        50      1     8k
  ...

What am I missing?

Dave




More information about the Crash-utility mailing list