lkml.org 
[lkml]   [2005]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: /proc/*/statm, exactly what does "shared" mean?
From
Date

Hugh,

Thank you immensely for answering this so clearly. Although it leaves
me at a short end, I am grateful I no longer have to bang my head in
this direction any further. I have wasted a HUGE amount of time in
recent months trying to figure out why different kernel versions caused
my applications memory footprint to change so.

That said, many mod_perl users are *VERY* interested in being able to
detect and observe how "shared" our forked children are. Shared meaning
private pages shared with children (copy on write). Is it even possible
to do this in 2.6 kernels? If so, any pointers would be very helpful.

Thanks again,

Richard F. Rebel

On Sat, 2005-02-12 at 13:06 +0000, Hugh Dickins wrote:
> On Fri, 11 Feb 2005, Richard F. Rebel wrote:
> > I can't seem to find clear documentation about the 'share' column
> > from /proc/<pid>/statm.
> >
> > Does this include pages that are shared with forked children marked as
> > copy-on-write?
> >
> > Does this only reflect libraries that are dynamically loaded? What
> > about shared memory segments/mmaps (ala shmat or mmmap)?
> >
> > If there is a place where I might find documentation that is more clear
> > beyond the proc.txt in the kernel docs and then man pages for procfs,
> > I'd welcome a pointer.
>
> You may not be entirely happy with this answer.
> It is a count of "pages of the process" which are "shared" in some sense.
> But precisely what that means has changed from time to time: depending on
> our perception of what we can safely afford the overhead of counting.
>
> You may want to look at fs/proc proc_pid_statm() source for the release
> of interest, and follow that back to see exactly what is being counted.
>
> Throughout 2.4 (and 2.2 too I think) it was the count of those pages
> instantiated in the process address space which currently have a page
> count greater than 1. That would include private pages shared with
> forked children, pages from the pagecache (including pages mapped
> from executable or library or shared memory or file mmap), those
> private pages which currently have swap allocated (so they're also
> in the swapcache), and any pages which transitorily have page count
> raised for whatever reason (they'd likely already be in one of the
> above categories). A ragbag of meanings, but that's all you can
> get from looking at page count.
>
> Counting up that not very meaningful number, at frequent intervals
> on large process address spaces, is a waste of valuable time.
>
> From 2.5.37 to 2.6.9, it's the total extent of file-backed areas
> (file including executable or library or shared memory) in the
> process address space: a total extent (in pagesize units),
> not a count of instantiated pages. Much quicker to calculate.
>
> But there were complaints about that, and a need to revert from
> total extent to count of instantiated pages.
>
> From 2.6.10 onwards, for the foreseeable future, it is the count
> of those pages instantiated in the process address space which are
> shared with a file (including executable or library or shared memory)
> i.e. those pages which are not anonymous, not private. That count
> does not include private pages shared with forked children, nor
> does it include private pages which happen to have swap allocated.
>
> Hugh
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Richard F. Rebel <rrebel@whenu.com>
WhenU.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site