Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2001 17:09:13 -0800 (PST)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        "Michael C . Wu" <keichii@iteration.net>
Cc:        "Forrest W. Christian" <forrestc@imach.com>, freebsd-small@FreeBSD.ORG
Subject:   Re: Sans-Swap VM Subsystem Questions
Message-ID:  <200102120109.f1C19DY01509@earth.backplane.com>
References:  <Pine.BSF.4.21.0102110001210.18747-100000@workhorse.iMach.com> <20010211185852.F19845@peorth.iteration.net>

next in thread | previous in thread | raw e-mail | index | archive | help

: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




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