Open
Description
Every time /proc/{pid}/smaps_rollup
or /proc/{pid}/smaps
is read, the kernel has to traverse all the page tables of the target process and look at all the struct page
instances that the entries in these page tables point to. That is not great for two reasons:
- Most importantly, this takes more time the more memory the process is using - disabling the smaps-based columns in htop reduces htop's CPU usage a lot on a machine that is using lots of memory.
- This causes lock contention with memory management operations in the process whose maps are being read; so running htop could induce latency spikes in other processes on the system.
It might be a good idea to put these metrics behind a warning somehow - obviously some users will want to know these numbers even if that makes htop several times more CPU-intensive, but there are probably also people like me who just thought "oh I have more space on my screen, might as well add those numbers".