Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Oct 1996 21:07:20 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        dtc@scrooge.ee.swin.oz.au (Douglas Thomas Crosher)
Cc:        current@freebsd.org
Subject:   Re: Request to add this to FAQ re: swap space
Message-ID:  <199610290207.VAA04150@dyson.iquest.net>
In-Reply-To: <199610290124.MAA25150@scrooge.ee.swin.oz.au> from "Douglas Thomas Crosher" at Oct 29, 96 12:24:25 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> My experience is that freebsd can use significantly more swap space
> than the maximum virtual size of processes. I see this when a process
> is continuously mapping and unmapping anonymous pages from a large
> mmaped region. E.g. A single process using 140M of virtual memory + a
> few other small processes can use up 192M.
> 
> Perhaps:
>  	swap-space = min(2*RAM, 2*sum of the sizes of all processes);
> 
> And:
> 
> ... The algorithm that is used by FreeBSD also requires that every
> anonymous page in a process be backed by at least an equivalent amount
> of swap space, and perhaps significantly more. ...
> 
Unfortunately there are at least three wild-cards:  the entire virtual
space is not shown by ps (there is a new mechanism, but would require a shell
script reading /proc/???/map), there are issues regarding the
inheritance of pages through fork, and sometimes the space is rounded
up by the swap pager.  Each of those can make it so that FreeBSD uses
more space than the total virtual size.  However, 2X should be too much
but allows for significant safety factor.

If you ever have a situation where FreeBSD uses more space than approx
1X the total size of all running processes, please get in touch with me.
At least we can get to the bottom of it.

The most accurate external indication of swap space reqs is in /proc/???/map
for ranges that are mapped COW and rw access;  So it would be interesting to
compare the ps virtual size with the proc filesystem on various machines.
That still doesn't account for SYSV shared memory regions (which can be
paged also.)

I agree that more swap is better, but at least we need to KILL the notion
that 2 X RAM is enough (IMO, 2 X RAM is never enough)!!!

John




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610290207.VAA04150>