Linux slabtop command - Display Kernel Slab Cache Information

July 11, 2014 | By
| Reply More

The Linux kernel needs to allocate memory for temporary objects such as task or device structures and inodes. The caching memory allocator manages caches of these types of objects. The modern Linux kernel implements this caching memory allocator to hold the caches called the slabs. Different types of slab caches are maintained by the slab allocator. This article concentrates on the slabtop command which shows real-time kernel slab cache information.

1. Command Usage:

The command is simple to use. Default execution does not mandate any arguments to the command. But it does require root privileges to access the kernel slab information. Executing the command as normal user gives following error:

Run slabtop as non-privileged user

You can run it by prepending "sudo" with slabtop. The default output looks like:

Slabtop default output

To quit from slabtop, just hit 'q' like you do for top command.

2. Slabtop options:

2.1 Display Interval:

By default slabtop refreshes every 3 seconds. But if you want, you can provide the refreshing interval in seconds with -d or --delay=N option:

Custom delay interval 01

Custom delay interval 02

2.2 Sort criteria:

There are many fields in slabtop output. The -s or --sort=S option sorts the output according to the mentioned sort criteria. This option will be discussed in detail in the next section.

2.3 Output once:

The -o or --once option does not refresh the output, instead it just throws the output once on STDOUT and exits.

Output once and exit

2.4 Version info:

The -V or --version displays the version of the command and exits.

Slabtop version

2.5 Help:

The common option, -h or --help displays usage of the command.

Slabtop help options

3. Sort Criteria:

The sort criteria determines which slab caches are displayed on top. Following are the sort criteria for slabtop:

3.1 ACTIVE:

Caches can be sorted by number of active objects with "a".

Sort by Active 01

Sort by Active 02

3.2 OBJ/SLAB:

The Objects per Slab can be selected with "b".

Sort by objects per slab 01

Sort by objects per slab 02

3.3 CACHE SIZE:

For selecting cache size, you need to provide "c".

Sort by cache size 01

Sort by cache size 02

3.4 SLABS:

The number of slabs. Select it with "l"

Sort by number of slabs 01

Sort by number of slabs 02

3.5 Active Slabs:

The number of Active Slabs. (Note that this is different from number of Active Objects described above.) Use "v" to sort according to this criteria.

Sort by Active Slabs 01

Sort by Active Slabs 02

3.6 NAME:

Name of cache. Corresponding character is "n"

Sort by cache name 01

Sort by cache name 02

3.7 OBJS:

To sort by number of objects, use "o"

Sort by number of objects 01

Sort by number of objects 02

3.8 Pages Per Slab:

"p" will sort by pages per slab

Sort by pages per slab 01

Sort by pages per slab 02

3.9 OBJ SIZE:

The object size is sorted by "s"

Sort by object size 01

Sort by object size 02

3.10 USE:

"u" sorts by the cache utilization.

Sort by cache utilization 01

Sort by cache utilization 02

Filed Under : LINUX COMMANDS, LINUX HOWTO

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.