From owner-freebsd-current Mon Oct 28 18:07:43 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id SAA15185 for current-outgoing; Mon, 28 Oct 1996 18:07:43 -0800 (PST) Received: from dyson.iquest.net ([198.70.144.127]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id SAA15179 for ; Mon, 28 Oct 1996 18:07:39 -0800 (PST) Received: (from root@localhost) by dyson.iquest.net (8.8.2/8.6.9) id VAA04150; Mon, 28 Oct 1996 21:07:21 -0500 (EST) From: "John S. Dyson" Message-Id: <199610290207.VAA04150@dyson.iquest.net> Subject: Re: Request to add this to FAQ re: swap space To: dtc@scrooge.ee.swin.oz.au (Douglas Thomas Crosher) Date: Mon, 28 Oct 1996 21:07:20 -0500 (EST) Cc: current@freebsd.org In-Reply-To: <199610290124.MAA25150@scrooge.ee.swin.oz.au> from "Douglas Thomas Crosher" at Oct 29, 96 12:24:25 pm Reply-To: dyson@freebsd.org X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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