Subject: Re: mfs & swap problems.
To: None <>
From: Ty Sarna <>
List: amiga-dev
Date: 04/19/1994 22:56:13
In article <> Bill Squier <> writes:
> This suggestion interests me, as I find that gcc compiles lock the
> system in direct proportion to the amount of current activity (running
> apps).  Without forcing a huge explanation of the mfs internals
> (although that would be interesting) can you explain what's going on?

Yes, the Net/2 VM system overcommits memory, that is it will allocate
memory to processes for which it doesn't have backing store (swap
space). As processes modify copy-on-write pages or otherwise cause the
VM system to actually give them the memory they allocated, swap is used
up. If the vm system has overcommited and a process needs more when
there is no swap left, the only two options the system has are to crash
(as Net/2 and NetBSD do) or kill process to free up memory (as FreeBSD)
does. Neither are really attractive options, but by that point it's too
late to do anything else.

As I understand it, mfs simply allocates as much memory as you tell it,
by default this is the size of the partition you mount it on, unless you
specify -s.  As you use mfs, it will actually recieve memory from the
system, but can't give it back (because in fact it's already allocate
the whole thing -- as far as it knows, it already owns all of it).  So,
it uses up swap space that it doesn't give back, and generally
exacerbates the overcommit situation. If you're using a lot of swap and
a lot of /tmp (as when building with gcc), you're much more likely to
run out of swap.

> Most NetBSD implementations that I've seen simply include a line such
> as:
> /dev/sd1b               /tmp    mfs     rw      1       1
> in their /etc/fstab.  Is this incorrect for a system with only one
> swap partition?

No, it should be something like:

  /dev/sd1b		  /tmp	  mfs	  rw,-sX  0 	  0

Where X is a number (in blocks) that leaves you a enough of your swap
partiton to be useful. The last two numbers should be zero,
see fstab(5). The two fields mean frequencey between dumps (backups) and
pass in which to fsck them. You don't want to back up or fsck mfs, so
set them to zero.

I think the reason so many people mount /tmp with no -s is simply
because they don't realize how mfs works. I too thought it was like
sun's tmpfs or AmigaDOS RAM:, and dynamicly grew/shrunk. In actually
it's like RAD:, and by default allocates ALL of your swap if you only
have one swap partition and don't use -s to limit it's usage.

When I found out how mfs really worked, I added -s and my system has
been *much* more stable ever since.

Ty Sarna                 "As you know, Joel, children have always looked        up to cowboys as role models. And vice versa."