How to get the information from /proc/files from within a kernel module?

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Fri Aug 29 16:23:19 EDT 2014


On Sat, 30 Aug 2014 01:21:12 +0530, ravali pullela said:

> The problem is that when i looked inside get_mm_rss function, it returns
>                 get_mm_counter(mm, MM_FILEPAGES) +
>                 get_mm_counter(mm, MM_ANONPAGES);
>
> I thought that anonymous and file pages cover all vm areas like stack,
> heap, code, data etc., but it does not look like. So, what is it that I am
> missing.

Perhaps nothing.  Perhaps everything.  Perhaps RSS isn't even the right
knob to be looking at.

There's different ways to calculate RSS, and which one you use depends on
what question you're trying to answer, and what problem you're trying to solve.
Which is why your method agrees with what summing /proc/self/smaps has, but
doesn't match what get_mm_counter() is telling you.

In particular, things like shared pages need different handling based on
what the problem is - if N processes share the page, does each process get
charged 1 per page, or 1/N per page?

So what problem are you trying to solve by knowing the RSS of a process, and
why does a module care? (Apologies if I missed the post)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140829/061afc7e/attachment-0001.bin 


More information about the Kernelnewbies mailing list