Watching slab usage with slabtop


The Linux kernel uses a slab based allocator to allocate kernel memory. Inside each slab is a collection of objects that have been allocated by one or more kernel subsystems. To monitor slab utilization in realtime, most modern day Linux distributions ship with the slaptop utility. When slabtop is run without any arguments, it displays a nice slab usage summary, and provides details of how various slabs are being used:

$ slabtop

Active / Total Objects (% used) : 220410 / 234629 (93.9%)
Active / Total Slabs (% used) : 4728 / 4728 (100.0%)
Active / Total Caches (% used) : 91 / 139 (65.5%)
Active / Total Size (% used) : 16609.59K / 18017.14K (92.2%)
Minimum / Average / Maximum Object : 0.01K / 0.08K / 128.00K

OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
80591 80494 99% 0.02K 397 203 1588K avtab_node
53562 53562 100% 0.03K 474 113 1896K size-32
35108 35099 99% 0.05K 524 67 2096K buffer_head
7378 7377 99% 0.27K 527 14 2108K radix_tree_node
7182 7182 100% 0.14K 266 27 1064K dentry_cache
6499 6497 99% 0.05K 97 67 388K selinux_inode_security
5460 5398 98% 0.04K 65 84 260K sysfs_dir_cache
3953 3425 86% 0.06K 67 59 268K size-64
3663 3644 99% 0.41K 407 9 1628K inode_cache
3654 479 13% 0.02K 18 203 72K biovec-1
2904 1882 64% 0.09K 66 44 264K vm_area_struct
2580 2442 94% 0.12K 86 30 344K size-128
2080 924 44% 0.19K 104 20 416K filp
2070 744 35% 0.12K 69 30 276K bio
1944 660 33% 0.05K 27 72 108K journal_head
1896 1892 99% 0.59K 316 6 1264K ext3_inode_cache
1595 525 32% 0.02K 11 145 44K anon_vma
1288 1209 93% 0.04K 14 92 56K Acpi-Operand
845 730 86% 0.02K 5 169 20K Acpi-Namespace
648 511 78% 0.05K 9 72 36K avc_node
540 471 87% 0.43K 60 9 240K proc_inode_cache

These is a sweet utility, and is another one of those tools that should be in every Linux administrators tool belt.

This article was posted by Matty on 2007-03-24 22:43:00 -0400 EDT