Re: [PATCH 4/4] maps: /proc/<pid>/pmaps interface - memory maps ingranularity of pages

From: Fengguang Wu
Date: Thu Aug 16 2007 - 23:45:03 EST


On Thu, Aug 16, 2007 at 09:38:46PM -0500, Matt Mackall wrote:
> On Fri, Aug 17, 2007 at 06:05:20AM +0800, Fengguang Wu wrote:
> > Show a process's page-by-page address space infomation in /proc/<pid>/pmaps.
> > It helps to analyze applications' memory footprints in a comprehensive way.
> >
> > Pages share the same states are grouped into a page range.
> > For each page range, the following fields are exported:
> > - first page index
> > - number of pages in the range
> > - well known page/pte flags
> > - number of mmap users
> >
> > Only page flags not expected to disappear in the near future are exported:
> >
> > Y:young R:referenced A:active U:uptodate P:ptedirty D:dirty W:writeback
> ...
>
> > The concern of dataset size is taken care of by working in a sparse way:
> >
> > 1) It will only generate output for resident pages, that normally is
> > much smaller than the mapped size. Take my shell for example, the
> > (size:rss) ratio is (7:1)!
> >
> > wfg ~% cat /proc/$$/smaps |grep Size|sum
> > sum 50552.000
> > avg 777.723
> >
> > wfg ~% cat /proc/$$/smaps |grep Rss|sum
> > sum 7604.000
> > avg 116.985
> >
> > 2) The page range trick suppresses more output.
> >
> > It's interesting to see that the seq_file interface demands some
> > more programming efforts, and provides such flexibility as well.
>
> I'm so-so on this.

Not that way! It's a good thing that people have different experiences
and hence viewpoints. Maybe the concept of PFN sharing are
straightforward to you, while I have been playing with seq_file a lot.

> On the downside:
>
> - requires lots of parsing
> - isn't random-access
> - probably significantly slower than pagemap

That could be true. Maybe some user with huge datasets will give us
some idea about the performance. I don't know, maybe it's application
dependent.

Anyway I don't think it's fair to merge a binary interface without the
challenge from a textual one ;)

Thank you,
Fengguang

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/