Re: swap problem: not freeing pages ?!

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Mon, 17 Jun 1996 21:57:40 +0200 (MET DST)


I've tried to reproduce this after rebooting the system (for other reasons)
but now eatmem was able to get ~41MB and calculating RSS+free+buffers+cached-shared
is *much* closer to the free mem (sum 43464k vs. 45840k total mem.).

note that the system had an uptime of 7 days when I did the first tests
where I realized this problem, so this looks a bit like a memory leak to me ?!

below is the complete output of "ps axm ; free" for that test,
here RSS+free+buffers+cached-shared = 36480k vs. 45840k total memory

-------------------------------------------------------------------------------
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
1 ? 152 60 0 0 80 80 0 0 0 0 (init)
2 ? 0 0 0 0 0 0 0 0 0 0 (kflushd)
3 ? 29333 0 0 0 0 0 0 0 0 0 (kswapd)
4 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
5 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
6 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
7 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
1400 p0 79 861 0 0 304 304 0 0 0 0 (bash)
205 1 166 722 0 0 344 344 0 0 0 0 (bash)
206 2 26 20 0 0 120 120 0 0 0 0 (getty)
59 ? 868 50 0 0 384 384 0 0 0 0 (syslogd)
68 ? 32 14 0 0 232 224 8 0 8 0 (klogd)
90 ? 2 12 0 0 104 104 0 0 0 0 (portmap)
108 ? 43 251 0 0 104 104 0 0 0 0 (inetd)
144 ? 91 983 0 0 248 248 0 0 0 0 (sendmail)
162 a1 100 10 0 0 64 64 0 0 0 0 (gpm)
172 ? 29 8 0 0 64 64 0 0 0 0 (lpd)
183 ? 0 10 0 0 240 240 0 0 0 0 (smbd)
207 3 26 20 0 0 120 120 0 0 0 0 (getty)
208 4 25 20 0 0 120 120 0 0 0 0 (getty)
209 5 26 20 0 0 120 120 0 0 0 0 (getty)
210 6 24 20 0 0 120 120 0 0 0 0 (getty)
211 S0 172 419 0 0 304 304 0 0 0 0 (bash)
3784 p1 71 138 0 0 296 296 0 0 0 0 (bash)
4151 p2 71 138 0 0 296 296 0 0 0 0 (bash)
3131 p0 593 121 0 0 992 992 0 0 0 0 (emacs)
1397 ? 161 140 0 0 656 656 0 0 0 0 (xterm)
4383 p3 71 138 0 0 296 296 0 0 0 0 (bash)
4433 p4 71 138 0 0 296 296 0 0 0 0 (bash)
3779 ? 154 110 0 0 656 656 0 0 0 0 (xterm)
4571 p5 582 2627 0 0 312 312 0 0 0 0 (bash)
16861 p5 830 162 0 0 1008 1008 0 0 0 0 (emacs)
16957 p5 901 162 0 0 1224 1224 0 0 0 0 (emacs)
4150 ? 154 110 0 0 656 656 0 0 0 0 (xterm)
4430 ? 154 110 0 0 656 656 0 0 0 0 (xterm)
4382 ? 154 110 0 0 656 656 0 0 0 0 (xterm)
17167 p6 451 174 0 0 1504 1504 0 0 0 0 (emacs)
17180 p6 43 50 0 0 344 344 0 0 0 0 (sed)
17181 p6 111 51 0 0 304 304 0 0 0 0 (less)
17349 p6 137 38 0 0 176 176 0 0 0 0 (top)
192 ? 641 54 40 8 144 96 48 32 0 2 nmbd -D
213 ? 0 2 48 8 80 24 56 40 0 2 update (bd
79 ? 643 43878 80 0 200 120 80 80 0 0 (crond)
4568 ? 1171 310 80 0 952 872 80 80 0 0 (xterm)
156 ? 5 28 8 8 192 104 88 88 72 11 (httpd)
160 ? 1 8 8 8 184 96 88 88 72 11 (httpd)
119 ? 15 14 88 8 208 112 96 72 0 3 rpc.mountd
128 ? 17 15 80 8 208 112 96 64 8 4 rpc.nfsd
17426 p6 53 23 184 8 296 0 296 176 104 15 ./ps axm
4569 ? 241 45 280 8 496 104 392 240 104 19 /usr/X11R6
4570 ? 1027 145 352 8 592 112 480 304 120 11 /usr/X11R6
16894 p6 1080 3071 464 8 704 32 672 416 200 32 bash
16893 ? 1754 506 512 8 1744 992 752 456 232 25 /usr/X11R6
17417 p5 12259 11100 40 0 40160 7536 32624 40 32584 4073 (eatmem)
RSS sum 35856

total used free shared buffers cached
Mem: 45840 45304 536 2000 136 1952
-/+ buffers: 43216 2624
Swap: 52216 31048 21168
-------------------------------------------------------------------------------

as you can see for my first test eatmem got no more than 32.5M,

after killing eatmem and running "swapoff -a ; swapon -a" I got

-------------------------------------------------------------------------------
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
2 ? 0 0 0 0 0 0 0 0 0 0 (kflushd)
3 ? 30932 0 0 0 0 0 0 0 0 0 (kswapd)
4 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
5 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
6 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
7 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
162 a1 100 10 8 4 32 0 32 0 20 8 gpm -t msc
172 ? 29 8 8 4 32 0 32 0 20 8 lpd
1 ? 152 60 8 8 40 0 40 0 24 10 init [3]
213 ? 0 2 24 4 40 0 40 20 12 5 update (bd
90 ? 2 12 8 4 52 0 52 0 40 13 portmap
108 ? 43 251 8 4 52 0 52 0 40 13 inetd
206 2 26 20 8 4 60 0 60 0 48 15 /sbin/gett
207 3 26 20 8 4 60 0 60 0 48 15 /sbin/gett
208 4 25 20 8 4 60 0 60 0 48 15 /sbin/gett
209 5 26 20 8 4 60 0 60 0 48 15 /sbin/gett
210 6 24 20 8 4 60 0 60 0 48 15 /sbin/gett
17349 p6 137 38 8 8 88 0 88 0 72 22 ./top
160 ? 1 8 12 12 92 0 92 44 68 23 httpd
156 ? 5 28 12 12 96 0 96 44 72 24 httpd
119 ? 15 14 44 4 104 0 104 36 56 17 rpc.mountd
128 ? 17 15 40 4 104 0 104 32 60 18 rpc.nfsd
79 ? 685 43892 56 8 108 0 108 48 44 15 crond
68 ? 32 14 0 8 116 0 116 0 108 28 klogd
183 ? 0 10 20 8 120 0 120 0 92 30 smbd -D
144 ? 91 983 12 8 124 0 124 0 104 31 sendmail:
192 ? 690 57 88 8 132 0 132 76 36 14 nmbd -D
3784 p1 71 138 24 8 148 0 148 0 116 37 -bash
4151 p2 71 138 24 8 148 0 148 0 116 37 -bash
4383 p3 71 138 24 8 148 0 148 0 116 37 -bash
4433 p4 71 138 24 8 148 0 148 0 116 37 -bash
17443 p6 24 23 92 4 148 0 148 88 52 15 ps axm
1400 p0 79 861 24 8 152 0 152 0 120 38 -bash
211 S0 172 419 24 8 152 0 152 0 120 38 -bash
17181 p6 111 51 8 8 152 0 152 0 136 38 less -siew
205 1 166 722 24 8 172 0 172 0 140 43 -bash
17180 p6 43 50 8 8 172 0 172 0 156 43 sed -e s,
59 ? 906 52 0 8 192 0 192 0 184 48 syslogd
4569 ? 241 45 148 12 248 0 248 120 88 32 /usr/X11R6
4570 ? 1056 152 184 12 296 0 296 152 100 35 /usr/X11R6
4571 p5 670 2644 192 8 324 0 324 168 124 39 -bash
1397 ? 161 140 40 16 328 0 328 0 272 82 /usr/X11R6
3779 ? 154 110 40 16 328 0 328 0 272 82 /usr/X11R6
4150 ? 154 110 40 16 328 0 328 0 272 82 /usr/X11R6
4430 ? 154 110 40 16 328 0 328 0 272 82 /usr/X11R6
4382 ? 154 110 40 16 328 0 328 0 272 82 /usr/X11R6
16894 p6 1115 3389 256 8 380 0 380 232 116 37 bash
3131 p0 593 121 272 120 496 0 496 0 104 124 emacs -nw
16861 p5 830 162 300 120 504 0 504 0 84 126 emacs -nw
16957 p5 901 162 340 120 612 0 612 0 152 153 emacs -nw
4568 ? 1304 327 276 16 672 0 672 236 380 109 /usr/X11R6
17167 p6 451 174 384 120 752 0 752 0 248 188 emacs -nw
16893 ? 1833 517 332 16 936 0 936 292 588 161 /usr/X11R6
sum 10224

total used free shared buffers cached
Mem: 45840 30184 15656 3000 192 3424
-/+ buffers: 26568 19272
Swap: 52216 0 52216
-------------------------------------------------------------------------------

I've tried to reproduce this situation by simulating the work of the last
days (starting tonns of Xserver, rsh, heavy swapping, lots of file access)
but I still get RSS+free+buffers+cached-shared > 42M.

this is the output immediately after reboot:
-------------------------------------------------------------------------------
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
2 ? 0 0 0 0 0 0 0 0 0 0 (kflushd)
3 ? 79414 0 0 0 0 0 0 0 0 0 (kswapd)
4 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
5 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
6 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
7 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
205 1 318 275 0 0 296 296 0 0 0 0 (bash)
68 ? 0 11 0 0 232 224 8 0 8 0 (klogd)
90 ? 2 12 0 0 104 104 0 0 0 0 (portmap)
108 ? 12 13 0 0 104 104 0 0 0 0 (inetd)
144 ? 7 22 0 0 248 248 0 0 0 0 (sendmail)
162 ? 12 7 0 0 64 64 0 0 0 0 (gpm)
172 ? 29 8 0 0 64 64 0 0 0 0 (lpd)
183 ? 0 10 0 0 240 240 0 0 0 0 (smbd)
207 3 19 21 0 0 120 120 0 0 0 0 (getty)
208 4 18 21 0 0 120 120 0 0 0 0 (getty)
209 5 19 21 0 0 120 120 0 0 0 0 (getty)
210 6 18 21 0 0 120 120 0 0 0 0 (getty)
211 S0 48 19 0 0 104 104 0 0 0 0 (getty)
213 ? 0 2 48 8 80 24 56 40 0 2 update (bd
1 ? 66 53 72 0 136 64 72 56 0 1 (init)
59 ? 906 49 0 0 384 296 88 0 88 2 (syslogd)
156 ? 5 28 8 8 192 104 88 88 72 11 (httpd)
160 ? 1 8 8 8 184 96 88 88 72 11 (httpd)
119 ? 21 15 88 8 208 112 96 72 0 3 rpc.mountd
128 ? 17 15 80 8 208 112 96 64 8 4 rpc.nfsd
79 ? 692 158 96 0 216 112 104 96 8 1 (crond)
192 ? 659 45 160 8 264 88 176 152 8 3 nmbd -D
303 2 53 20 184 8 288 0 288 176 96 14 ps axm
206 2 463 385 392 8 640 104 536 416 136 24 -bash
301 2 22 42 440 8 688 72 616 464 168 28 -bash
254 1 149535 80749 8 0 48128 7616 40512 8 40504 5063 (eatmem)
RSS sum 42824

total used free shared buffers cached
Mem: 45840 45288 552 1480 144 1024
-/+ buffers: 44120 1720
Swap: 52216 25680 26536
-------------------------------------------------------------------------------

and after simulated workload:
-------------------------------------------------------------------------------
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
1 ? 84 53 0 0 80 80 0 0 0 0 (init)
2 ? 0 0 0 0 0 0 0 0 0 0 (kflushd)
3 ? 202678 0 0 0 0 0 0 0 0 0 (kswapd)
4 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
5 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
6 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
7 ? 0 0 0 0 0 0 0 0 0 0 (nfsiod)
205 1 35 21 0 0 120 120 0 0 0 0 (getty)
206 2 23 21 0 0 120 120 0 0 0 0 (getty)
59 ? 2430 107 0 0 384 384 0 0 0 0 (syslogd)
68 ? 0 11 0 0 232 224 8 0 8 0 (klogd)
79 ? 1812 803 0 0 120 120 ..,, 0 0 0 0 (crond)
90 ? 2 12 0 0 104 104 0 0 0 0 (portmap)
108 ? 36 370 0 0 128 128 0 0 0 0 (inetd)
144 ? 91 34 0 0 248 248 0 0 0 0 (sendmail)
162 ? 58 7 0 0 64 64 0 0 0 0 (gpm)
172 ? 29 8 0 0 64 64 0 0 0 0 (lpd)
183 ? 0 10 0 0 240 240 0 0 0 0 (smbd)
207 3 29 21 0 0 120 120 0 0 0 0 (getty)
208 4 19 21 0 0 120 120 0 0 0 0 (getty)
209 5 19 21 0 0 120 120 0 0 0 0 (getty)
210 6 18 21 0 0 120 120 0 0 0 0 (getty)
211 S0 27 19 0 0 104 104 0 0 0 0 (getty)
213 ? 10 4 48 8 80 24 56 40 0 2 update (bd
192 ? 1776 100 56 8 160 96 64 48 0 2 nmbd -D
156 ? 5 28 8 8 192 104 88 88 72 11 (httpd)
160 ? 1 8 8 8 184 96 88 88 72 11 (httpd)
119 ? 23 15 88 8 208 112 96 72 0 3 rpc.mountd
128 ? 27 16 80 8 208 112 96 64 8 4 rpc.nfsd
1771 p0 53 20 184 8 288 0 288 176 96 14 ps axm
225 ? 342 39 280 8 496 104 392 240 104 19 /usr/X11R6
224 ? 3157 453 352 8 592 112 480 304 120 13 /usr/X11R6
227 p0 699 9478 424 8 760 152 608 464 176 26 -bash
1769 p0 26 46 472 8 808 112 696 512 216 33 -bash
226 ? 1002 230 632 8 1232 400 832 576 192 19 /usr/X11R6
1766 p0 7131 9515 40 0 48160 10512 37648 40 37608 4701 (eatmem)
RSS sum 41440

total used free shared buffers cached
Mem: 45840 45304 536 2464 160 1984
-/+ buffers: 43160 2680
Swap: 52216 16928 35288
-------------------------------------------------------------------------------

enough data to get some more ideas what's wrong ?

Harald

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^