Understanding memory usage on Linux hosts just got easier


While looking at the features that were added to the Linxu 2.6.20.X kernels, I came across this gem on the kernelnewbies website:

“Measuring how much memory processes are using is more difficult than it looks, specially when processes are sharing the memory used. Features like /proc/$PID/smaps (added in 2.6.14) help, but it has not been enough. 2.6.25 adds new statistics to make this task easier. A new /proc/$PID/pagemaps file is added for each process. In this file the kernel exports (in binary format) the physical page localization for each page used by the process. Comparing this file with the files of other processes allows to know what pages they are sharing. Another file, /proc/kpagemaps, exposes another kind of statistics about the pages of the system. The author of the patch, Matt Mackall, proposes two new statistic metrics: “proportional set size” (PSS) - divide each shared page by the number of processes sharing it; and “unique set size” (USS) (counting of pages not shared). The first statistic, PSS, has also been added to each file in /proc/$PID/smaps. In this HG repository you can find some sample command line and graphic tools that exploits all those statistics.”

This is awesome, and I thinking having USS and PSS statistics will greatly help admins understand how memory is being used on their systems. If you want to read more about this, check out the following LWN article.

This article was posted by Matty on 2009-03-25 21:15:00 -0400 -0400