<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"><<a href="mailto:Valdis.Kletnieks@vt.edu" target="_blank">Valdis.Kletnieks@vt.edu</a>></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>
> The problem is that when i looked inside get_mm_rss function, it returns<br>
> get_mm_counter(mm, MM_FILEPAGES) +<br>
> get_mm_counter(mm, MM_ANONPAGES);<br>
><br>
> I thought that anonymous and file pages cover all vm areas like stack,<br>
> heap, code, data etc., but it does not look like. So, what is it that I am<br>
> missing.<br>
<br>
</div>Perhaps nothing. Perhaps everything. Perhaps RSS isn't even the right<br>
knob to be looking at.<br>
<br>
There's different ways to calculate RSS, and which one you use depends on<br>
what question you're trying to answer, and what problem you're trying to solve.<br>
Which is why your method agrees with what summing /proc/self/smaps has, but<br>
doesn'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>