title: Linux OS: /proc/[pid]/smaps vs /proc/[pid]/statm
body: <p>I would like calculate the memory usage for single process. So after a little bit of research I came across over smaps and statm.</p>
  
  <p>First of all what is smaps and statm? What is the difference?</p>
  
  <p>statm has a field RSS and in smaps I sum up all RSS values. But those values are different for the same process. I know that statm measures in pages. For comparison purposes I converted that value in kb as in smaps. But those values are not equal.
  Why do these two values differ, even though they represent the rss value for the same process?</p>
  
  <pre><code>statm
  232214 80703 7168 27 0 161967 0 (measured in pages, pages size is 4096)
  
  smaps
  Rss 1956
  </code></pre>
  
  <p>My aim is to calculate the memory usage for a single process. I am interested in two values. USS and PSS.
  Can I gain those two values by just using smaps? Is that value correct?
  Also, I would like to return that value as percentage.</p>