[comp.sys.ibm.pc.rt] Using swapon with a RT running 4.3bsd

zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (03/14/91)

Has anyone sucessfully used swapon on a rt running 4.3bsd?

hd0b and hd2b are about 16MB each.  memhog tried to grab 7MB and failed.
i
irie:/u2/tmp $ ulimit -m
8000
irie:/u2/tmp $
irie:/u2/tmp $ cat /etc/fstab
/dev/hd0a /                     ufs rw 1 1
/dev/rhd0b swap                 swap rw 0 0
/dev/hd1a /u2                   ufs rq 1 3
/dev/hd1b /u3                   ufs rq 1 4
/dev/hd2a /u4                   ufs rq 1 3
/dev/rhd2b swap                 swap rw 0 0
irie:/u2/tmp $ swapon -a
Adding /dev/rhd0b as swap device
Adding /dev/rhd2b as swap device
irie:/u2/tmp $ ./memhog
malloc failed
irie:/u2/tmp $ vmstat
 procs     memory              page              faults                  cpu
r b w   avm   fre  re at  pi  po  fr  de  sr h0 h1 h2 d3  in  sy  cs us sy id
 1 0 0  2664  3496   0  1   2   0   0   0   0  2  1  0  0  35 157  46  4 11 85
irie:/u2/tmp $

From top:
Memory:  5822K  (3168K) real,  7810K  (3890K) virtual,  3144K free

Looks to me like swapon just doesn't work.  Perhaps I'm doing something
wrong?


-- 
Jon Zeeff (NIC handle JZ)	 zeeff@b-tech.ann-arbor.mi.us

webb@ibmpa.awdpa.ibm.com (Bill Webb) (03/19/91)

In article <VPT-V4+@b-tech.uucp>, zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) writes:
|> Has anyone sucessfully used swapon on a rt running 4.3bsd?
|> 
|> hd0b and hd2b are about 16MB each.  memhog tried to grab 7MB and failed.
|> i
|> irie:/u2/tmp $ ulimit -m
|> 8000
|> irie:/u2/tmp $
|> irie:/u2/tmp $ cat /etc/fstab
|> /dev/hd0a /                     ufs rw 1 1
|> /dev/rhd0b swap                 swap rw 0 0
|> /dev/hd1a /u2                   ufs rq 1 3
|> /dev/hd1b /u3                   ufs rq 1 4
|> /dev/hd2a /u4                   ufs rq 1 3
|> /dev/rhd2b swap                 swap rw 0 0
|> irie:/u2/tmp $ swapon -a
|> Adding /dev/rhd0b as swap device
|> Adding /dev/rhd2b as swap device
|> irie:/u2/tmp $ ./memhog
|> malloc failed
|> irie:/u2/tmp $ vmstat
|>  procs     memory              page              faults                  cpu
|> r b w   avm   fre  re at  pi  po  fr  de  sr h0 h1 h2 d3  in  sy  cs us sy id
|>  1 0 0  2664  3496   0  1   2   0   0   0   0  2  1  0  0  35 157  46  4 11 85
|> irie:/u2/tmp $
|> 
|> From top:
|> Memory:  5822K  (3168K) real,  7810K  (3890K) virtual,  3144K free
|> 
|> Looks to me like swapon just doesn't work.  Perhaps I'm doing something
|> wrong?
|> 
|> -- 
|> Jon Zeeff (NIC handle JZ)	 zeeff@b-tech.ann-arbor.mi.us

Well, given that 'ulimit -m' shows memoryuse, which is the amount of 
memory you are allowed to use before it starts getting paged out, I suspect
that the problem is that you didn't change the data size (e.g. use
the ksh command 'ulimit -d 8000' or the csh command 'limit data 8m'). 

Other ways to determine if the swapon command worked properly (from the output
I think that it actually did though see below for some doubts about that),
are the commands 'pstat -T' and 'systat -swap'. 

systat is particularly useful as it not only shows that you turned on swapping
on the appropriate devices but also where the swap blocks are currently 
distributed.

Note that the amount of free virtual pages isn't necessarily helpful as
the system caches free'd text pages in case they might be needed again - these
can be freed to actually give up more space if you run a large program.

One other thing that I noticed that might cause problems is that normally
the swap device is a block device not a raw device, here are the 
entries from my RT:

	grep sw /etc/fstab

	/dev/hd0b /swap swap sw 0 0
	/dev/hd1b /swap swap sw 0 0
	/dev/hd2b /swap swap sw 0 0

However, when I attempted to turn on swapping on a raw device I didn't
get the message:
	Adding /dev/rhd0b as swap device
So unless your /dev/rhd0b is actually a block device or a symlink to
a block device I can't really explain why you got the proper message
from swapon for an improper swap device!

----------------------------------------------------------------
The above views are my own, not necessarily those of my employer.
Bill Webb (IBM AWD Palo Alto, Ca.), (415) 855-4457.
UUCP: ...!uunet!ibmsupt!webb INTERNET: webb@ibminet.awdpa.ibm.com