From owner-freebsd-current Mon Oct 28 17:22:45 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA12876 for current-outgoing; Mon, 28 Oct 1996 17:22:45 -0800 (PST) Received: from scrooge.ee.swin.oz.au (scrooge.ee.swin.oz.au [136.186.4.20]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id RAA12870 for ; Mon, 28 Oct 1996 17:22:42 -0800 (PST) Received: (from dtc@localhost) by scrooge.ee.swin.oz.au (8.6.9/8.6.9) id MAA25150 for current@freebsd.org; Tue, 29 Oct 1996 12:24:26 +1100 From: Douglas Thomas Crosher Message-Id: <199610290124.MAA25150@scrooge.ee.swin.oz.au> Subject: Re: Request to add this to FAQ re: swap space To: current@freebsd.org Date: Tue, 29 Oct 1996 12:24:25 +1100 (EST) In-Reply-To: <199610290016.TAA00994@dyson.iquest.net> from "John S. Dyson" at Oct 28, 96 07:16:00 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > How much disk should I allocate for swap? > > Each OS has different algorithms for swap memory allocation. FreeBSD > takes maximum advantage of available RAM by fairly agressively pushing > seldom used pages out to disk. The algorithm that is used by FreeBSD > also requires that every anonymous page in a process be backed by an > equivalent amount of swap space. Additionally, due to the way that > the algorithm works, the swap space needs to be at least as a very > minimum, the size of physical ram. But, ignore that statement, because > in practical terms, the minimum amount of swap space should be MUCH larger... ... > The best formula to use is to calculate the size of all of the processes > that you plan to run, and use that value (with a practical minimum of > 2 times RAM.) Figure that a heavily used X windows workstation can easily ... > comfortable. And remember, you need swap space for every anonymous page > in a process. ... > So, to make it simple: > > swap-space = min(2*RAM, sum of the sizes of all processes); > > as usual, add some space in for expansion and for process growth. 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. ... Regards Douglas Crosher