<div dir="ltr">I am trying to calculate rss just to get an understanding and insights into handling memory in kernel.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 30, 2014 at 1:53 AM,  <span dir="ltr">&lt;<a href="mailto:Valdis.Kletnieks@vt.edu" target="_blank">Valdis.Kletnieks@vt.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Sat, 30 Aug 2014 01:21:12 +0530, ravali pullela said:<br>
<br>
&gt; The problem is that when i looked inside get_mm_rss function, it returns<br>
&gt;                 get_mm_counter(mm, MM_FILEPAGES) +<br>
&gt;                 get_mm_counter(mm, MM_ANONPAGES);<br>
&gt;<br>
&gt; I thought that anonymous and file pages cover all vm areas like stack,<br>
&gt; heap, code, data etc., but it does not look like. So, what is it that I am<br>
&gt; missing.<br>
<br>
</div>Perhaps nothing.  Perhaps everything.  Perhaps RSS isn&#39;t even the right<br>
knob to be looking at.<br>
<br>
There&#39;s different ways to calculate RSS, and which one you use depends on<br>
what question you&#39;re trying to answer, and what problem you&#39;re trying to solve.<br>
Which is why your method agrees with what summing /proc/self/smaps has, but<br>
doesn&#39;t match what get_mm_counter() is telling you.<br>
<br>
In particular, things like shared pages need different handling based on<br>
what the problem is - if N processes share the page, does each process get<br>
charged 1 per page, or 1/N per page?<br>
<br>
So what problem are you trying to solve by knowing the RSS of a process, and<br>
why does a module care? (Apologies if I missed the post)<br>
</blockquote></div><br></div>