[SLUG] The mystery of the missing memory!

2006-02-12 Thread Luke Kendall
If I run top and hit M to get a listing sorted by memory usage, I see
that 98% of memory is used up, as follows:

20% buffers
20% cached
23% non 0.0% processes
 1% free 

Where is the missing 36%?

Ah! I think to myself I have 52 processes other processes using
'0.0%' memory.  What if I guess they're each really using 0.04%
memory

Rats, that only explains another 2.6%.

Any ideas?  I'm stumped.

$ top --version
top (procps version 2.0.7)

This is on an old RH 7.2 system using kernel 2.4.28.

top interesting bits:

 11:13pm  up 74 days, 56 min,  1 user,  load average: 0.10, 0.04, 0.01
84 processes: 77 sleeping, 2 running, 2 zombie, 3 stopped
CPU states:  0.0% user,  0.3% system,  0.0% nice, 99.6% idle
Mem:   255716K av,  251356K used,4360K free,   0K shrd,   53528K buff
Swap:  265032K av,  237716K used,   27316K free   52428K cached

  PID USER PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
 1273 root  18   0  255M  10M   732 R 0.0  4.3  1012m X
 2451 luke  18   0 13932 8864  2388 S 0.0  3.4   7:21 postilion.exec
 1061 xfs9   0 16780 7492   336 S 0.0  2.9   0:49 xfs
17278 stella 9   0  6440 6440  4092 S 0.0  2.5   0:00 postilion.exec
15573 stella 9   0  6432 6432  4088 S 0.0  2.5   0:17 postilion.exec
15571 root   9   0  2236 2184  1480 S 0.0  0.8   0:07 sshd
 5937 luke   9   0 12192 2096  1160 S 0.0  0.8   0:00 postilion.exec
  745 ntp9   0  1924 1924  1732 S 0.0  0.7   0:00 ntpd
16392 root   9   0  1644 1644  1256 S 0.0  0.6   0:00 fetchmail
17160 stella 9   0  1416 1412   400 S 0.0  0.5   0:00 ispell
 1290 luke   9   0  1868 1344   684 S 0.0  0.5   2:06 wmaker
18057 luke   9   0  2948 1164   428 S 0.0  0.4 105:16 smbd
17321 luke  18   0   968  968   756 R 0.1  0.3   0:00 top
 1309 luke   9   0  1108  944   644 S 0.0  0.3   0:02 bash
 5918 luke   9   0  1356  808   368 S 0.0  0.3   0:00 ispell
 1307 luke   9   0   936  724   428 S 0.0  0.2   0:01 bash
 1295 luke   9   0  1948  648   296 S 0.0  0.2   0:07 wterm
 1296 luke   9   0  1956  640   352 S 0.0  0.2   0:09 wterm
  625 rpcuser9   0   664  568   564 S 0.0  0.2   0:00 rpc.statd
 1084 root   9   0   880  564   428 S 0.0  0.2   0:04 nmbd
  572 root   9   0   608  552   512 S 0.0  0.2   0:03 syslogd
15901 root   9   0   508  508   436 S 0.0  0.1   0:00 portsentry
  577 root   9   0  1352  496   452 S 0.0  0.1   0:00 klogd
15897 root   9   0   492  492   420 S 0.0  0.1   0:01 portsentry
  597 rpc9   0   572  488   484 S 0.0  0.1   0:00 portmap
  800 root   9   0   452  440   252 S 0.0  0.1   0:13 smartd
 1297 luke   9   0   584  428   328 S 0.0  0.1   0:00 xcb
  947 root   8   0   848  424   308 S 0.0  0.1   0:06 sendmail
10423 luke   9   0   668  420   300 S 0.0  0.1   0:00 wterm
  818 root   9   0   528  400   336 S 0.0  0.1   0:04 sshd
 1299 luke   9   0   468  364   260 S 0.0  0.1  45:07 wmmail
 1079 root   9   0   688  296   208 S 0.0  0.1   0:00 smbd
  874 lp 8   0   360  252   208 S 0.0  0.0   0:00 lpd
10424 luke   8   0   592  240   236 S 0.0  0.0   0:00 bash
 1298 luke   9   0   296  228   176 S 0.0  0.0   0:10 wmclock
  852 root   9   0   328  140   136 S 0.0  0.0   0:00 xinetd
10616 luke   9   0   220  13292 S 0.0  0.0   0:03 asmixer
  985 root   9   0   172  11676 S 0.0  0.0   0:00 crond
  903 root   9   0   200  112   108 S 0.0  0.0   0:00 rpc.rquotad
  533 root   9   0   168  108   104 S 0.0  0.0   0:00 mingetty
 1142 root   8   0   136   8060 S 0.0  0.0   0:00 rhnsd
1 root   8   0   120   7252 S 0.0  0.0   0:06 init
 1121 daemon 9   0   104   4432 S 0.0  0.0   0:00 atd
 1087 root   9   0   456   3632 S 0.0  0.0   0:00 nmbd
 1764 root   9   0   156   2824 S 0.0  0.0   0:00 rpc.mountd
 1201 root   9   0   268   2016 S 0.0  0.0   0:00 login
 1203 root   9   076   1612 S 0.0  0.0   0:00 mingetty
 1204 root   9   076   1612 S 0.0  0.0   0:00 mingetty
 1205 root   9   076   1612 S 0.0  0.0   0:00 mingetty
[... the remaining 35 0.0%-memory using process omitted]

I also notice that if I start 5 galeon browser windows, I get 6 galeon
processes each using 34.4% memory (another 200% memory used).

The man page for top says %MEM The task's share of the physical memory.

None of these numbers add up, for me!  Even if I assume the man page is
wrong, and it should say %MEM   The task's share of the physical memory,
except when the process that's listed is sharing memory with others.

Puzzled,

luke

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: 

Re: [SLUG] The mystery of the missing memory!

2006-02-12 Thread Menno Schaaf
There's a nice thread on the gentoo forum that explains this (and some more)

http://forums.gentoo.org/viewtopic.php?t=175419

On 2/10/06, Luke Kendall [EMAIL PROTECTED] wrote:
 If I run top and hit M to get a listing sorted by memory usage, I see
 that 98% of memory is used up, as follows:

 20% buffers
 20% cached
 23% non 0.0% processes
  1% free

 Where is the missing 36%?

 Ah! I think to myself I have 52 processes other processes using
 '0.0%' memory.  What if I guess they're each really using 0.04%
 memory

 Rats, that only explains another 2.6%.

 Any ideas?  I'm stumped.

 $ top --version
 top (procps version 2.0.7)

 This is on an old RH 7.2 system using kernel 2.4.28.

 top interesting bits:

  11:13pm  up 74 days, 56 min,  1 user,  load average: 0.10, 0.04, 0.01
 84 processes: 77 sleeping, 2 running, 2 zombie, 3 stopped
 CPU states:  0.0% user,  0.3% system,  0.0% nice, 99.6% idle
 Mem:   255716K av,  251356K used,4360K free,   0K shrd,   53528K buff
 Swap:  265032K av,  237716K used,   27316K free   52428K 
 cached

   PID USER PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
  1273 root  18   0  255M  10M   732 R 0.0  4.3  1012m X
  2451 luke  18   0 13932 8864  2388 S 0.0  3.4   7:21 postilion.exec
  1061 xfs9   0 16780 7492   336 S 0.0  2.9   0:49 xfs
 17278 stella 9   0  6440 6440  4092 S 0.0  2.5   0:00 postilion.exec
 15573 stella 9   0  6432 6432  4088 S 0.0  2.5   0:17 postilion.exec
 15571 root   9   0  2236 2184  1480 S 0.0  0.8   0:07 sshd
  5937 luke   9   0 12192 2096  1160 S 0.0  0.8   0:00 postilion.exec
   745 ntp9   0  1924 1924  1732 S 0.0  0.7   0:00 ntpd
 16392 root   9   0  1644 1644  1256 S 0.0  0.6   0:00 fetchmail
 17160 stella 9   0  1416 1412   400 S 0.0  0.5   0:00 ispell
  1290 luke   9   0  1868 1344   684 S 0.0  0.5   2:06 wmaker
 18057 luke   9   0  2948 1164   428 S 0.0  0.4 105:16 smbd
 17321 luke  18   0   968  968   756 R 0.1  0.3   0:00 top
  1309 luke   9   0  1108  944   644 S 0.0  0.3   0:02 bash
  5918 luke   9   0  1356  808   368 S 0.0  0.3   0:00 ispell
  1307 luke   9   0   936  724   428 S 0.0  0.2   0:01 bash
  1295 luke   9   0  1948  648   296 S 0.0  0.2   0:07 wterm
  1296 luke   9   0  1956  640   352 S 0.0  0.2   0:09 wterm
   625 rpcuser9   0   664  568   564 S 0.0  0.2   0:00 rpc.statd
  1084 root   9   0   880  564   428 S 0.0  0.2   0:04 nmbd
   572 root   9   0   608  552   512 S 0.0  0.2   0:03 syslogd
 15901 root   9   0   508  508   436 S 0.0  0.1   0:00 portsentry
   577 root   9   0  1352  496   452 S 0.0  0.1   0:00 klogd
 15897 root   9   0   492  492   420 S 0.0  0.1   0:01 portsentry
   597 rpc9   0   572  488   484 S 0.0  0.1   0:00 portmap
   800 root   9   0   452  440   252 S 0.0  0.1   0:13 smartd
  1297 luke   9   0   584  428   328 S 0.0  0.1   0:00 xcb
   947 root   8   0   848  424   308 S 0.0  0.1   0:06 sendmail
 10423 luke   9   0   668  420   300 S 0.0  0.1   0:00 wterm
   818 root   9   0   528  400   336 S 0.0  0.1   0:04 sshd
  1299 luke   9   0   468  364   260 S 0.0  0.1  45:07 wmmail
  1079 root   9   0   688  296   208 S 0.0  0.1   0:00 smbd
   874 lp 8   0   360  252   208 S 0.0  0.0   0:00 lpd
 10424 luke   8   0   592  240   236 S 0.0  0.0   0:00 bash
  1298 luke   9   0   296  228   176 S 0.0  0.0   0:10 wmclock
   852 root   9   0   328  140   136 S 0.0  0.0   0:00 xinetd
 10616 luke   9   0   220  13292 S 0.0  0.0   0:03 asmixer
   985 root   9   0   172  11676 S 0.0  0.0   0:00 crond
   903 root   9   0   200  112   108 S 0.0  0.0   0:00 rpc.rquotad
   533 root   9   0   168  108   104 S 0.0  0.0   0:00 mingetty
  1142 root   8   0   136   8060 S 0.0  0.0   0:00 rhnsd
 1 root   8   0   120   7252 S 0.0  0.0   0:06 init
  1121 daemon 9   0   104   4432 S 0.0  0.0   0:00 atd
  1087 root   9   0   456   3632 S 0.0  0.0   0:00 nmbd
  1764 root   9   0   156   2824 S 0.0  0.0   0:00 rpc.mountd
  1201 root   9   0   268   2016 S 0.0  0.0   0:00 login
  1203 root   9   076   1612 S 0.0  0.0   0:00 mingetty
  1204 root   9   076   1612 S 0.0  0.0   0:00 mingetty
  1205 root   9   076   1612 S 0.0  0.0   0:00 mingetty
 [... the remaining 35 0.0%-memory using process omitted]

 I also notice that if I start 5 galeon browser windows, I get 6 galeon
 processes each using 34.4% memory (another 200% memory used).

 The man page for top says %MEM The task's share of the physical memory.

 None of these numbers add up, for me!  Even if I assume the man page is
 wrong, and it should say 

Re: [SLUG] The mystery of the missing memory!

2006-02-12 Thread jam
On Monday 13 February 2006 02:39, [EMAIL PROTECTED] wrote:
 I also notice that if I start 5 galeon browser windows, I get 6 galeon
 processes each using 34.4% memory (another 200% memory used).

 The man page for top says %MEM The task's share of the physical memory.

 None of these numbers add up, for me!  Even if I assume the man page is
 wrong, and it should say %MEM   The task's share of the physical memory,
 except when the process that's listed is sharing memory with others.

You need to forget your windows-centric view of memory as a commodity.
Try xosview to see the global view of your memory usage.
Processes ALWAYS share memory with others (but eg: ash is built to not use 
shared libs).
Some processes show memory usage that is actually swap.

Imagine the confusion:
John runs top on TheProg and finds its memory usage goes from 100M down to 10M 
as swap gets used.
Jane runs top on TheProg and finds its memory usage goes from 100M to 250M !!

Top lets me examine a process, not (try) to do system accounting
Frankly there is no such thing as 90% memory used. 90% of memory should ALWAYS 
be used, if not you have a faulty system.

So I guess the question should be 'what are you trying to measure'. For me 
your galeon example is exactly what I'd expect to see. This is useful info, 
and no doubt exactly what top is designed to display.
James
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html