How to get the information from /proc/files from within a kernel module?
ravali pullela
rpravali069 at gmail.com
Sat Aug 30 03:40:47 EDT 2014
I am trying to calculate rss just to get an understanding and insights into
handling memory in kernel.
On Sat, Aug 30, 2014 at 1:53 AM, <Valdis.Kletnieks at vt.edu> wrote:
> 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 --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140830/5a79db2d/attachment.html
More information about the Kernelnewbies
mailing list