hugetop
Display hugepage usage by process.
Description
A TUI tool that shows which processes are using hugepages, sorted by total hugepage usage. Displays both HugeTLB (explicit hugepages) and transparent hugepages (AnonHugePages) per process, along with a system-wide summary.
Only processes with non-zero hugepage usage are shown.
Press q to quit.
Inputs
System-wide
/proc/meminfo– hugepage statistics:AnonHugePages– transparent hugepages in use (anonymous)ShmemHugePages– transparent hugepages in use (shared memory)HugePages_Total– total number of preallocated hugepagesHugePages_Free– number of unallocated hugepagesHugePages_Rsvd– reserved but not yet allocated hugepagesHugePages_Surp– surplus hugepages above the configured poolHugepagesize– default hugepage size (typically 2048 kB)Hugetlb– total memory in HugeTLB pages
Per-process
/proc/[pid]/status–HugetlbPagesfield (explicit hugepage usage)/proc/[pid]/smaps_rollup–AnonHugePagesfield (transparent hugepage usage, aggregated across all mappings)/proc/[pid]/stat– PID and command name/etc/passwd– UID to username resolution (cached)
Arguments
| Flag | Description |
|---|---|
-d, --delay SECS | Refresh interval in seconds (default: 2, minimum: 0.5) |
Behavior
Display layout
The terminal is divided into two regions:
-
System summary (top 4 lines):
- HugeTLB pool status: total, free, reserved, surplus, page size
- Transparent hugepage totals: anonymous and shared memory
- Count of processes currently using hugepages
-
Process table (remaining space):
- Sorted by total hugepage usage (descending)
- Columns: PID, USER, HUGETLB, ANON_HUGE, TOTAL, COMMAND
Columns
| Column | Description |
|---|---|
| PID | Process ID |
| USER | Effective user name |
| HUGETLB | Explicit HugeTLB usage (from /proc/[pid]/status) |
| ANON_HUGE | Transparent hugepage usage (from /proc/[pid]/smaps_rollup) |
| TOTAL | Sum of HUGETLB + ANON_HUGE |
| COMMAND | Process name (comm) |
Size formatting
Values are displayed in human-readable units: K (kibibytes), M (mebibytes), or G (gibibytes), automatically scaled.
Color
Row color indicates the magnitude of hugepage usage:
- Default: total < 1 MiB
- Yellow: total >= 1 MiB
- Red: total >= 1 GiB
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 (user pressed q) |
| 1 | Failure (terminal initialization error or proc read failure) |