[comp.unix.questions] more on unix swap space problem

jwp@larry.sal.wisc.edu (Jeffrey W Percival) (05/02/89)

I received several replies to my question in comp.unix.wizards
about the "not enough core" message.  All pointed out that my
swap partition is probably too small for the amount of work
being done.

One reply mentioned the "swap" entry in fstab, and sure enough,
we don't have such an entry.

The Question:  is the :sw: entry in fstab truly needed, or is
the swap info compiled into the kernel?
-- 
Jeff Percival (jwp@larry.sal.wisc.edu)

karish@forel.stanford.edu (Chuck Karish) (05/03/89)

In article <171@larry.sal.wisc.edu> jwp@larry.sal.wisc.edu
(Jeffrey W Percival) wrote:
[ "not enough core" to run small utilities ]

>One reply mentioned the "swap" entry in fstab, and sure enough,
>we don't have such an entry.

>The Question:  is the :sw: entry in fstab truly needed, or is
                                           ^^^^^
>the swap info compiled into the kernel?

	Let's not get overly metaphysical here.  When we put the
	lines into the file, the problem went away.

	Chuck Karish		{decwrl,hpda}!mindcrf!karish
	(415) 493-7277		karish@forel.stanford.edu

chris@mimsy.UUCP (Chris Torek) (05/03/89)

In article <171@larry.sal.wisc.edu> jwp@larry.sal.wisc.edu
(Jeffrey W Percival) writes:
[BSDish system]
>The Question:  is the :sw: entry in fstab truly needed, or is
>the swap info compiled into the kernel?

Both.

The kernel has compiled into it the list of devices it *might ever*
swap on.  Initially, it swaps/pages/allocates_backing_store_from only
the first; the others are added with the vswapon() system call, made by
/etc/swapon, which is normally run as

	swapon -a

from /etc/rc.  With -a, swapon reads fstab to find :sw: entries and
calls vswapon() with the devices found in this way.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

guy@auspex.auspex.com (Guy Harris) (05/03/89)

>The Question:  is the :sw: entry in fstab truly needed,

Yes.

>or is the swap info compiled into the kernel?

Yes.  (Probably.)

The problem is that in 4.xBSD's swapping code, as I remember, you have
to both

	1) tell the kernel that it is to permit swapping on a particular
	   device when you build the kernel (so, in that sense, it's
	   compiled into the kernel, although you should be able to
	   reconfigure this without kernel source)

and

	2) tell the kernel that it is to *use* a particular swap area
	   when the system comes up multi-user, which is done by putting
	   a ":sw:" entry in "fstab" and running "/etc/swapon" in one of
	   the "/etc/rc*" files ("/etc/swapon" does a "swapon" call to
	   turn swapping on for a particular partition).  The only
	   exception is the *first* swapping area, which is built into
	   the kernel and automatically turned on when you boot.

I think SunOS 4.0 has lifted restriction 1), which is an improvement.

bph@buengc.BU.EDU (Blair P. Houghton) (05/04/89)

In article <17245@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>
>The kernel has compiled into it the list of devices it *might ever*
>swap on.  Initially, it swaps/pages/allocates_backing_store_from only
>the first; the others are added with the vswapon() system call, made by
>/etc/swapon,[...]

I ran into the insufficient-memory bug, too.

My sysadmin (the fella sitting to my left) says that the swap space is
protected in such a way that an overlarge set of /usr/adm files won't
affect it.  I was attributing the problem to the fact that we've allowed
/usr/adm/acct to hit 17meg.  He says they're unrelated.  I don't buy it.

				--Blair

chris@mimsy.UUCP (Chris Torek) (05/04/89)

In article <2760@buengc.BU.EDU> bph@buengc.BU.EDU (Blair P. Houghton) writes:
>My sysadmin (the fella sitting to my left) says that the swap space is
>protected in such a way that an overlarge set of /usr/adm files won't
>affect it.  I was attributing the problem to the fact that we've allowed
>/usr/adm/acct to hit 17meg.  He says they're unrelated.  I don't buy it.

He is correct.  Swap space is allocated only as backing store for
processes.  It is completely unaffected by file sizes (although file
sizes may affect the amount of memory allocated by programs reading
or writing those files).

Under some systems (SunOS 4.x and Mach), you can swap on ordinary
files, so if you run out of VM, you can make a big file and add it
to the backing store pool.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

guy@auspex.auspex.com (Guy Harris) (05/04/89)

>My sysadmin (the fella sitting to my left) says that the swap space is
>protected in such a way that an overlarge set of /usr/adm files won't
>affect it.  I was attributing the problem to the fact that we've allowed
>/usr/adm/acct to hit 17meg.  He says they're unrelated.  I don't buy it.

Uh, well, it depends on what flavor of UNIX you're running, but if your
swap space is on a disk partition of its own, he's right.  If your
system swaps to/from plain files on the same partition that contains
"/usr/adm", they could be related.

Most UNIXes tend, when swapping to a local disk, to swap to a "raw"
partition, since that's what the original AT&T version did.  Apollo's
isn't derived from AT&T's version at that level, and I think it
pages/swaps to/from plain files; I think the same may be true of Mach. 
Diskless machines running SunOS 4.x can page/swap to an NFS file; others
may have modified AT&T-derived UNIXes to page/swap to local or
over-the-wire files as well.

bph@buengc.BU.EDU (Blair P. Houghton) (05/05/89)

In article <17287@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>In article <2760@buengc.BU.EDU> bph@buengc.BU.EDU (Blair P. Houghton) writes:
>>My sysadmin (the fella sitting to my left) says that the swap space is
>>protected in such a way that an overlarge set of /usr/adm files won't
>>affect it.  I was attributing the problem to the fact that we've allowed
>>/usr/adm/acct to hit 17meg.  He says they're unrelated.  I don't buy it.
>
>He is correct.[...]

I'll buy it.  It's been pointed out to me that excessive use of X
applications can fill up the swap space itself toot sweet, causing the
problem I get.

He may be correct, but the dozen xterms he runs from .login say he's being
a memory-hog.

				--Blair
				  "All I got is this one li'l window
				   for rn, and my login window, and
				   that spare, and that one with the
				   SPICE runs, and that xsplot with the
				   SPICE graphs, and the two artistically
				   arranged xclocks, and the bitmap of
				   Einstein, glaring at me all the time
				   to imagine more and know less, but
				   THAT's ALL... I swear... :-)"