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
| Flag | Description |
|---|---|
-d, --delay SECS | Refresh interval in seconds (default: 3, minimum: 0.5) |
-s, --sort CHAR | Sort criterion (default: o). See sort criteria below. |
-o, --once | Display 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.
| Key | Sort by | Column |
|---|---|---|
a | Number of active objects (descending) | ACTIVE |
b | Objects per slab (descending) | OBJ/SLAB |
c | Cache size (descending) | CACHE SIZE |
l | Number of slabs (descending) | SLABS |
n | Cache name (ascending, alphabetical) | NAME |
o | Number of objects (descending) | OBJS |
p | Pages per slab (descending) | – |
s | Object size (descending) | OBJ SIZE |
u | Cache utilization percentage (descending) | USE% |
Behavior
TUI mode (default)
The terminal is divided into two regions:
-
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
-
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 * 4096bytes - USE%:
active_objs / num_objs * 100
Interactive commands
| Key | Action |
|---|---|
q / Q | Quit |
| Space | Force immediate refresh |
a, b, c, l, n, o, p, s, u | Change sort criterion |
Up / k | Scroll up one row |
Down / j | Scroll down one row |
| Page Up | Scroll up 20 rows |
| Page Down | Scroll down 20 rows |
| Home | Scroll to top |
| End | Scroll to bottom |
| Mouse wheel | Scroll 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
| Code | Meaning |
|---|---|
| 0 | Normal exit |
| 1 | Failure (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 bareUSE. - Error messages for invalid flag combinations and option-parse failures use different wording.