[comp.unix.aix] Page Space Problems

bfls@cain.anu.edu.au (Barbara La Scala) (03/14/91)

I think this has been mentioned before but (like a fool) I didn't take note
of it.  I was attempting to compile an ordinary sized program only to have
my compilation abort with the error message

 1501-229 Compilation ended due to lack of space

After much searching around I discovered (in /usr/lpp/xlc/bin/README.xlc)
that this error message means the system has run out of page space.  The "lsps"
command, which lists the attributes of your paging space, shows that 83% of my
32MB swap space is used, even though I'm not running any large programs.  In
fact according to the output from ps, the only process which is using a
significant amount of memory is the swapper, which is using around 50% of
memory!  Is this normal? (I can't find any info on "swapper" in InfoExplorer).
Assuming it isn't, is there any way (short of a reboot) I can free up my swap
space?  

Help!

Barbara La Scala		Internet: bfls@cain.anu.edu.au
Australian National University

ransom@perelandra.austin.ibm.com (Jeff Peek) (03/14/91)

In article <BFLS.91Mar14152256@cain.anu.edu.au> bfls@cain.anu.edu.au (Barbara La Scala) writes:
>In fact according to the output from ps, the only process which is using a
>significant amount of memory is the swapper, which is using around 50% of
>memory!  Is this normal? (I can't find any info on "swapper" in InfoExplorer).
The swapper is a kernel process running in kernel mode. The data that ps is displaying
is actually the size of the kernel segment. Now, why the kernel is so large depends
on what subsystem you had running, i.e., TCP/IP, NFS, SNA, etc. Also, it depends
on what level of OS you are running, i.e., 3001, etal. 
>Assuming it isn't, is there any way (short of a reboot) I can free up my swap
>space?  
Stopping and restarting the subsystems should clean up and extra space they were
using. How much memory do you have?
>
>Help!
>
>Barbara La Scala		Internet: bfls@cain.anu.edu.au
>Australian National University


Jeff Peek
AIX Operating System Architecture -- IBM Personal Systems Programiming        
ransom@perelandra.austin.ibm.com 	VNET PEEK at AUSVMQ T/L 793-3935
Austin, TX

jet@karazm.math.uh.edu ("J. Eric Townsend") (03/18/91)

In article <BFLS.91Mar14152256@cain.anu.edu.au> bfls@cain.anu.edu.au (Barbara La Scala) writes:
>32MB swap space is used, even though I'm not running any large programs.  In
>fact according to the output from ps, the only process which is using a
>significant amount of memory is the swapper, which is using around 50% of
>memory!

About once a month I jump up and down about this.

I called defect(ive) support, they told me "AIX does things a little
differently than UNIX", and that the swapper proc was supposed to be
~6Mb on a 8Mb RAM / 32Mb paging machine.

It's not a bug, it's a *feature* :-(

Again, I repeat my plea for some IBM employee to come out of the woodwork
and explain this:

oiler> ps aux
    USER   PID %CPU %MEM    SZ   RSS     TT STAT  TIME CMD
    root     0 0.0%  78%  7592  6376      -    S  1:31 swapper
    root     1 0.1%   1%   164   120      -    S  2:41 /etc/init 
    root   514 0.0%   0%    12     8      -    R 3994:08 kproc
    root   771 0.0%   0%    20    20      -    S  0:05 kproc
    root  1028 0.1%   0%    16    16      -    S  3:45 kproc
    root  1285 0.0%   0%    16     8      -    S  0:00 kproc
    root  1685 0.0%   0%    84    28      -    S  0:18 /etc/syncd 60 
     jet  1867 2.9%   5%   168   404  pts/0    S  0:01 -csh 
....
--
J. Eric Townsend - jet@uh.edu - bitnet: jet@UHOU - vox: (713) 749-2120
Skate UNIX or bleed, boyo...
(UNIX is a trademark of Bell Laboratories).

ransom@perelandra.austin.ibm.com (Jeff Peek) (03/18/91)

In article <1991Mar17.185553.9181@menudo.uh.edu> jet@karazm.math.uh.edu ("J. Eric Townsend") writes:
>Again, I repeat my plea for some IBM employee to come out of the woodwork
>and explain this:
>
>oiler> ps aux
>    USER   PID %CPU %MEM    SZ   RSS     TT STAT  TIME CMD
>    root     0 0.0%  78%  7592  6376      -    S  1:31 swapper
>    root     1 0.1%   1%   164   120      -    S  2:41 /etc/init 
>    root   514 0.0%   0%    12     8      -    R 3994:08 kproc
>    root   771 0.0%   0%    20    20      -    S  0:05 kproc
>    root  1028 0.1%   0%    16    16      -    S  3:45 kproc
>    root  1285 0.0%   0%    16     8      -    S  0:00 kproc
>    root  1685 0.0%   0%    84    28      -    S  0:18 /etc/syncd 60 
>     jet  1867 2.9%   5%   168   404  pts/0    S  0:01 -csh 
>....
[my previous posting about what SZ meant for process 0 was incorrect.]
OK. You wanted it you got it. I did some mucking around in the code and 
actual experimentation on the machine and here is what I found. 
When you run ps -lk (the way I used to get the sizes for all the kprocs)
you get:
    F S  UID   PID  PPID   C PRI NI ADDR    SZ    WCHAN    TTY  TIME CMD
  b03 S    0     0     0 120  16 -- 1008 11008               -  4:50 swapper
  303 R    0   514     0 103 127 -- 1209    28               - 9332:43 kproc
  303 S    0   771     0   0  37 --  a05    36    20cd0      -  4:00 kproc
  303 S    0  1028     0   1  39 -- 160b    36    20cd8      - 10:20 kproc
  303 S    0  1285     0   0  36 -- 180c    32    20ce0      -  0:00 kproc
40201 S    0  1645     1   0  60 20 3058    32               -  0:00 kproc
40a01 S    0  2641     1   0  60 20  e27    32               -  0:00 kproc
40b03 S    0  4016     1   0  39 --  8a4    32  1bbd844      -  3:08 kproc
  a01 S    7  7856  4527   0  60 20  fc7    32               -  0:00 kproc
Here is a description of what is in the SZ field:
  SZ (-l, l)    The size in 1024 byte units of the core image of the
    		process.
So, SZ is in 1K chunks. Then it appears my swapper is close to 11meg.

The nitty gritty:
The SZ is based on the number of paging space blocks (4K) associated with
the TEXT and DATA segments for a process. Note, this is NOT real memory, just
the number of page spaces blocks used by the process. The DATA segment includes
user data, user stack, kernel stack, and the ublock.

Now, the segments register values used for the calculation are taken from the
u_adspace structure from the process's ublock. These srvals amount to the user's
address space in USER MODE! 

The swapper is a special kproc, handcrafted at System Initialization. The u_adspace
structure for the swapper is never initialized, i.e., it is all zeroes. On the 
RISC System/6000 an invalid segment register value is 7fffff. '0' is a valid
srval and in fact is the srval for the kernel's text segment. This segment is 
only addressable to processes in kernel mode. So, ps is counting the kernel's TEXT
segment TWICE for process 0. The reason this is not a problem for other kernel processes
is that their u_adspace structure is inherited from their parent when they are
created, thus initialized properly. 

Only process 0 has no parent (or is it it's own mother and father?).

The strange but true facts about the swapper.

>--
>J. Eric Townsend - jet@uh.edu - bitnet: jet@UHOU - vox: (713) 749-2120
>Skate UNIX or bleed, boyo...
>(UNIX is a trademark of Bell Laboratories).


Jeff Peek
AIX Operating System Architecture -- IBM Personal Systems Programiming        
ransom@perelandra.austin.ibm.com 	VNET PEEK at AUSVMQ T/L 793-3935
Austin, TX

rmilner@zia.aoc.nrao.edu (Ruth Milner) (03/19/91)

In article <1991Mar17.185553.9181@menudo.uh.edu> jet@karazm.math.uh.edu ("J. Eric Townsend") writes:
>
>I called defect(ive) support, they told me "AIX does things a little
>differently than UNIX", and that the swapper proc was supposed to be
>~6Mb on a 8Mb RAM / 32Mb paging machine.
>
>It's not a bug, it's a *feature* :-(
>
>Again, I repeat my plea for some IBM employee to come out of the woodwork
>and explain this:
>
>oiler> ps aux
>    USER   PID %CPU %MEM    SZ   RSS     TT STAT  TIME CMD
>    root     0 0.0%  78%  7592  6376      -    S  1:31 swapper

I have formed the impression (nobody told me this, though) that the SZ etc.
shown for swapper were not so much used by swapper as they were representative
of the size of the kernel. It's a paging kernel, so not all of it has to be
in memory all the time, and the size given seems to stay pretty static when
you put more memory in. That's just an impression, though.

IBM take note: the size of your kernel is a serious limitation for low-end
systems. A 320 has really respectable floating-point performance, but our
application (and probably others) needs a minimum of 32MB on an RS/6000 to 
run reasonably (performance almost doubled when we went from 16 to 32MB). With 
the price of RS/6000 memory, this really reduces its affordability as a system
for small groups at universities to run our data reduction programs.
-- 
Ruth Milner
Systems Manager                     NRAO/VLA                    Socorro NM
                            rmilner@zia.aoc.nrao.edu