Hi Perrin,

Does this report or help illustrate shared COW pages between apache
processes?  I thought that particular part of /proc/<pid>/statm reported
the pages potentially shared with other processes as they are part of
dynamically loaded libraries.

On my 2.6 kernel:

bash-2.05b$ echo $$
25964
bash-2.05b$ cat /proc/25964/statm
793 449 582 197 0 596 0
bash-2.05b$

According to 'man proc'

       /proc/[number]/statm
              Provides information about memory status in pages.  The
columns
              are:
               size       total program size
               resident   resident set size
               share      shared pages
               trs        text (code)
               drs        data/stack
               lrs        library
               dt         dirty pages

Of course the man page isn't all that illuminating.

When I check top, the SHARE column says 2328, which is exactly 4 (page
size) x the 'share' number column number from top.  From what I
understand so far, this does not represent COW pages shared between
related processes.

Do I have the wrong end of the stick here?  (Id rather I did, because I
have been using GTop to test my stuff before releasing).

Best,

On Thu, 2005-02-10 at 18:32 -0500, Perrin Harkins wrote:
> On Thu, 2005-02-10 at 18:28 -0500, Richard F. Rebel wrote:
> > As far as I know, especially on linux, there is no way to tell exactly
> > how 'shared' your apache processes are, except by using apache+mod_perl
> > with GTop (and it's associated apache module).  I certainly don't know
> > of a way to get this figure from the command line.  Maybe someone else
> > on the list does.
> 
> You can read it from /proc.  From Apache::SizeLimit:
> 
> sub linux_size_check {
>     my($size, $resident, $share) = (0, 0, 0);
> 
>     my $file = "/proc/self/statm";
>     if (open my $fh, "<$file") {
>         ($size, $resident, $share) = split /\s/, scalar <$fh>;
>         close $fh;
>     } else {
>         error_log("Fatal Error: couldn't access $file");
>     }
> 
>     # linux on intel x86 has 4KB page size...
>     return ($size * 4, $share * 4);
> }
> 
> - Perrin
> 
-- 
Richard F. Rebel <[EMAIL PROTECTED]>
WhenU.com

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to