htop icon indicating copy to clipboard operation
htop copied to clipboard

Feature Request: Hugepage columns on Linux

Open haarp opened this issue 2 weeks ago • 1 comments

We have a meter for Hugepages, but no columns for them. This would be quite useful if you're actually using hugepages, as telling wich processes uses how much is non-trivial.

Relevant columns:

  • HUGETLB: explicit hugepages (HugetlbPages in /proc/$pid/status)
  • THP: transparent hugepages (aggregate of AnonHugePages in /proc/pid/smaps_rollup)
  • HUGE: total sum of both explicit and transparent

This is what hugetop displays.

Thanks! :)

haarp avatar Nov 15 '26 11:11 haarp

I’ve reviewed the counter readings from the test I ran with Codex in a Linux 6.12.76 aarch64 container using a 32 MiB private anonymous mapping, madvise(MADV_HUGEPAGE), and a write to each page. The live process reported:

/proc/$pid/status:        HugetlbPages:       0 kB
/proc/$pid/smaps_rollup:  AnonHugePages:  32768 kB

The host had no reserved explicit huge pages, so this only exercises the transparent-page side. The small reproducer is available on request.

At current main (b9dc8aa), htop already reads smaps_rollup when a PSS/SWAP column is enabled, falls back to smaps on older kernels, and reads process-shared values on alternating passes. This suggests the requested AnonHugePages could share that existing path, including its unavailable-value handling. There is also an existing discussion of the cost of these columns in #1712.

If either source cannot be read, would you prefer HUGE to show unavailable rather than a partial sum? I can put together a patch using the requested AnonHugePages definition once that behavior is agreed.

rayw-lab avatar Nov 22 '26 15:11 rayw-lab