- Clear the soft-dirty bits on the PTEs on a chosen process by writing "4" to /proc/$PID/clear_refs
- Wait a while for some page activity to occur
- Read the soft-dirty bits on the PTEs to see which pages got written to.
Running it on X, compiz, firefox or thunderbird is quite instructive as one can see a lot of page activity on the large heap allocations. The ability to see pages getting swapped out when memory pressure is high is also rather useful.
|Page view of Xorg|
|Memory view of stack|
So, to install on Xenial, currently one needs to do:
sudo add-apt-repository ppa:colin-king/pagemon
sudo apt-get update
sudo apt-get install pagemon
I may be adding a few more features in the next few weeks, and then getting the tool into Ubuntu and Debian.
and as an example, running it on Xorg, it is invoked as:
sudo pagemon -p $(pidof Xorg)
Unfortunately sudo is required to allow one to dig so intrusively into a running process. For more details on how to use pagemon consult the pagemon man page, or press "h" or "?" while running pagemon.