Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

slabtop

Display kernel slab cache information in real time.

Description

Displays detailed kernel slab cache information as a sorted table with a statistics summary header. Shows the top slab caches sorted by a user-selectable criterion. Requires read access to /proc/slabinfo (typically root).

Press q to quit. Press a sort key to change the sort order interactively. Press space to force a refresh.

Inputs

  • /proc/slabinfo – kernel slab allocator statistics (version 2.1 format). Each line contains: name, active objects, total objects, object size, objects per slab, pages per slab, tunables, and slab data (active slabs, total slabs).

Arguments

FlagDescription
-d, --delay SECSRefresh interval in seconds (default: 3, minimum: 0.5)
-s, --sort CHARSort criterion (default: o). See sort criteria below.
-o, --onceDisplay output once to stdout and exit (no TUI)

Sort criteria

The sort criterion can be set via -s at startup or changed interactively by pressing the corresponding key.

KeySort byColumn
aNumber of active objects (descending)ACTIVE
bObjects per slab (descending)OBJ/SLAB
cCache size (descending)CACHE SIZE
lNumber of slabs (descending)SLABS
nCache name (ascending, alphabetical)NAME
oNumber of objects (descending)OBJS
pPages per slab (descending)
sObject size (descending)OBJ SIZE
uCache utilization percentage (descending)USE%

Behavior

TUI mode (default)

The terminal is divided into two regions:

  1. Summary header (top 6 lines):

    • Active / Total Objects (% used)
    • Active / Total Slabs (% used)
    • Active / Total Caches (% used)
    • Active / Total Size (% used)
    • Minimum / Average / Maximum Object size
  2. Slab table (remaining space):

    • Columns: OBJS, ACTIVE, USE%, OBJ SIZE, SLABS, OBJ/SLAB, CACHE SIZE, NAME
    • Sorted by the selected criterion

Once mode (-o)

Prints the slab table to stdout in plain text format and exits. Does not enter the TUI. Useful for scripting.

Color

USE% column color indicates cache utilization:

  • Green: >= 90% utilization
  • Yellow: >= 50% utilization
  • Red: < 50% utilization (with objects allocated)

Computed fields

  • CACHE SIZE: num_slabs * pages_per_slab * 4096 bytes
  • USE%: active_objs / num_objs * 100

Interactive commands

KeyAction
q / QQuit
SpaceForce immediate refresh
a, b, c, l, n, o, p, s, uChange sort criterion
Up / kScroll up one row
Down / jScroll down one row
Page UpScroll up 20 rows
Page DownScroll down 20 rows
HomeScroll to top
EndScroll to bottom
Mouse wheelScroll up/down 3 rows

Terminal handling

Uses ratatui with crossterm as the terminal backend. Enters alternate screen and raw mode on startup, restores the terminal on exit.

Exit codes

CodeMeaning
0Normal exit
1Failure (cannot read /proc/slabinfo or terminal error)

Divergences from procps-ng

  • The use-percentage column header is USE% (with the percent sign baked into the column name) rather than procps-ng’s bare USE.
  • Error messages for invalid flag combinations and option-parse failures use different wording.