From owner-freebsd-small Sun Feb 11 17: 9:32 2001 Delivered-To: freebsd-small@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 4161237B401 for ; Sun, 11 Feb 2001 17:09:27 -0800 (PST) Received: (from dillon@localhost) by earth.backplane.com (8.11.2/8.9.3) id f1C19DY01509; Sun, 11 Feb 2001 17:09:13 -0800 (PST) (envelope-from dillon) Date: Sun, 11 Feb 2001 17:09:13 -0800 (PST) From: Matt Dillon Message-Id: <200102120109.f1C19DY01509@earth.backplane.com> To: "Michael C . Wu" Cc: "Forrest W. Christian" , freebsd-small@FreeBSD.ORG Subject: Re: Sans-Swap VM Subsystem Questions References: <20010211185852.F19845@peorth.iteration.net> Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :The general idea is that many parts of FreeBSD sometimes count on :having swap and such. Can you use some part of the flash disk for :swap? :i.e. if (no_swap == TRUE) {bad_things_happen(); return ENOTVERYGOOD;} Swapping to flash is not a good idea. Flash devices have a limited number of rewrite cycles before they die. The swap system assumes that it can swap things in and out regularly. :| In my system, since I don't have swap, and limited memory, I would like to :| ensure that the above described piece of the VM subsystem continues to :| work. That way, it can effectively "run from flash" if necessary. :| However, as memory is (always) tight in this environment, I would :| also like to remove the SWAPPING code (as opposed to the "free" code :| described above) from the kernel. : :I believe there is a NO_SWAP option in LINT/NOTES. However, I remember :Peter Wemm stating in a certain forum that do such things is BAD(TM). The swapping capability is heavily integrated into most of the kernel. Removing the removable pieces is not going to gain you much in the way of space. :| I'd also like to hear people's experience with running with and without :| the two swap-related kernel variables turned on without swap. I realize : :The performance decreases drastically with no VM on. I am not the :VM expert, but I think it is true. I have CC'ed Matt Dillon, our :VM guru, just to make sure. :) :-- :+------------------------------------------------------------------+ :| keichii@peorth.iteration.net | keichii@bsdconspiracy.net | It depends what kind of memory pressure you are under. It is possible to operate without swap if you are extremely careful in regards to the amount of memory you 'dirty'. What I would recommend for anyone running a SWAPless kernel for a turnkey application is to either compile *ALL* programs -static, or try to collapse all the shared libraries into a single shared library. Even though -static increases the size of the binary image, it will actually *REDUCE* the number of pages the kernel dirties in memory when loading the program (e.g. because the kernel does not have to mess around with relocations of library calls). And, even though the RSS may be slightly higher, it will be made up of more clean pages. The kernel has no problem freeing up clean pages (backed by the original binary images in the flash memory), whereas without swap the kernel has no way to free up dirty pages. I also strongly recommend running with the 'H' malloc.conf option (see 'man malloc'). Beyond that, you have to be very, very, very careful in how you write the programs that will run under such a system. Remember, clean pages are essentially free, dirty pages cost memory. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message