The shared memory reported by statm is not what you think it is.  See fork doesn't handle copy-on-write correctly and in particular Rik van Riel's reply:

The shared pages statistic is reported so low because they are measured differently, not because any deficiency in COW. COW still works fine.

Older kernels used to walk all the page table entries to count how many of the pages were shared with other processes.

This was too inefficient. Think of a server with a thousand Oracle processes, each having 2.7GB of virtual memory. Every screen update in top(1) would end up scanning the ptes for 2.7TB of memory!

Because of this, the newer kernels no longer look at page table entries. Instead, they count entire MAP_SHARED VMAs as shared memory. They no longer count the still shared COW pages in anonymous memory, since it is way too inefficient to count those.


In reply to Re: shared pages between parent and child by almut
in thread shared pages between parent and child by perl5ever

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.