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

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 hugepages
    • HugePages_Free – number of unallocated hugepages
    • HugePages_Rsvd – reserved but not yet allocated hugepages
    • HugePages_Surp – surplus hugepages above the configured pool
    • Hugepagesize – default hugepage size (typically 2048 kB)
    • Hugetlb – total memory in HugeTLB pages

Per-process

  • /proc/[pid]/statusHugetlbPages field (explicit hugepage usage)
  • /proc/[pid]/smaps_rollupAnonHugePages field (transparent hugepage usage, aggregated across all mappings)
  • /proc/[pid]/stat – PID and command name
  • /etc/passwd – UID to username resolution (cached)

Arguments

FlagDescription
-d, --delay SECSRefresh interval in seconds (default: 2, minimum: 0.5)

Behavior

Display layout

The terminal is divided into two regions:

  1. 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
  2. Process table (remaining space):

    • Sorted by total hugepage usage (descending)
    • Columns: PID, USER, HUGETLB, ANON_HUGE, TOTAL, COMMAND

Columns

ColumnDescription
PIDProcess ID
USEREffective user name
HUGETLBExplicit HugeTLB usage (from /proc/[pid]/status)
ANON_HUGETransparent hugepage usage (from /proc/[pid]/smaps_rollup)
TOTALSum of HUGETLB + ANON_HUGE
COMMANDProcess 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

CodeMeaning
0Normal exit (user pressed q)
1Failure (terminal initialization error or proc read failure)