[oclug] swap/memory tools

Ian! D. Allen idallen at idallen.ca
Mon Nov 29 09:16:09 EST 2004


On Mon, Nov 29, 2004 at 05:15:23AM -0500, GR Gaudreau wrote:
> I have 512 MB of RAM, do I really need a swap file?

If your system is one of the more modern Linux kernels and it using
any swap, it does so because it thinks putting stuff out to swap will
improve overall responsiveness.  Be careful if you think you know better
than the scheduling algorithms what is needed.

Here's a snapshot of my home system running kernel 2.6.8.1-20mdk:

# free
             total       used       free     shared    buffers     cached
Mem:       1556316    1241580     314736          0     403860     169324
-/+ buffers/cache:     668396     887920
Swap:       498004        776     497228

# top     # <== sorted by memory
top - 09:09:18 up 1 day, 19:25,  8 users,  load average: 1.05, 1.03, 1.00
Tasks: 160 total,   3 running, 153 sleeping,   4 stopped,   0 zombie
Cpu(s):  7.3% us,  0.7% sy, 92.0% ni,  0.0% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   1556316k total,  1239340k used,   316976k free,   403712k buffers
Swap:   498004k total,      776k used,   497228k free,   169264k cached

  PID USER      NI  VIRT  RES S %CPU %MEM    TIME+  SWAP nFLT COMMAND          
23836 idallen    0  124m  59m S  3.6  3.9   1:04.91  65m   61 mozilla-bin       
10933 root       0  106m  56m S  3.0  3.7   6:39.90  50m   21 X                 
20793 idallen   19 18748  16m R 92.2  1.1 139:06.36 2336    0 setiathome_4.02   
11157 idallen    0 21568  12m S  0.3  0.9   2:02.38 8304   59 gaim              
11449 idallen    0 10652 9456 S  0.0  0.6   0:03.86 1196    0 screen            
 9585 apache     0 10444 5516 S  0.0  0.4   0:00.02 4928    2 httpd2            
23953 apache     0 10444 5488 S  0.0  0.4   0:00.03 4956    3 httpd2            
13365 apache     0 10444 5484 S  0.0  0.4   0:00.00 4960    1 httpd2            
 9577 root       0 10240 5240 S  0.0  0.3   0:00.15 5000   17 httpd2            
 4945 xfs        0  6460 5180 S  0.0  0.3   0:00.24 1280   19 xfs               

Note that though top insists that there is a whole pile of swap being
used, "free" shows that it isn't actually swapped to disk yet.

-- 
-IAN!  Ian! D. Allen   Ottawa, Ontario, Canada
       EMail: idallen at idallen.ca   WWW: http://www.idallen.com/
       College professor (Linux) via: http://teaching.idallen.com/
       Support free and open public digital rights:  http://eff.org/



More information about the OCLUG mailing list