Re: [mp1 and mp2] Grokking memory

[prev] [thread] [next] [Date index for 2005/02/11]

From: Richard F. Rebel
Subject: Re: [mp1 and mp2] Grokking memory
Date: 00:33 on 11 Feb 2005
--=-LnKbx4fWBDmkzfiaHCGk
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


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.
>=20
> You can read it from /proc.  From Apache::SizeLimit:
>=20
> sub linux_size_check {
>     my($size, $resident, $share) =3D (0, 0, 0);
>=20
>     my $file =3D "/proc/self/statm";
>     if (open my $fh, "<$file") {
>         ($size, $resident, $share) =3D split /\s/, scalar <$fh>;
>         close $fh;
>     } else {
>         error_log("Fatal Error: couldn't access $file");
>     }
>=20
>     # linux on intel x86 has 4KB page size...
>     return ($size * 4, $share * 4);
> }
>=20
> - Perrin
>=20
--=20
Richard F. Rebel <rrebel@xxxxx.xxx>
WhenU.com

--=-LnKbx4fWBDmkzfiaHCGk
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBCC/08x1ZaISfnBu0RAjw3AJ9ch07Emb7Dhd4o8KPX9EdkQKNNrQCePIiL
4blS+ji1fbHEulzR8K/dmOs=
=Egtv
-----END PGP SIGNATURE-----

--=-LnKbx4fWBDmkzfiaHCGk--

(message missing)

[mp1 and mp2] Grokking memory
ben syverson 22:27 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
Richard F. Rebel 22:40 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
ben syverson 22:51 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
Richard F. Rebel 23:28 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
Perrin Harkins 23:32 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
Richard F. Rebel 00:33 on 11 Feb 2005

Re: [mp1 and mp2] Grokking memory
ben syverson 23:43 on 10 Feb 2005

Re: [mp1 and mp2] Grokking memory
Richard F. Rebel 00:35 on 11 Feb 2005

Re: [mp1 and mp2] Grokking memory
Perrin Harkins 21:57 on 11 Feb 2005

Re: [mp1 and mp2] Grokking memory
Steven Lembark 19:39 on 13 Feb 2005

Generated at 11:21 on 20 Feb 2005 by mariachi v0.52