RELENG_4 on flash disk and swap

Dmitry Pryanishnikov dmitry at
Fri Mar 10 11:58:04 UTC 2006


> Date:      Fri, 3 Mar 2006 08:04:55 -0500 
> From:      Michael Proto <mike at>
> To:        freebsd-stable at
> Subject:   Re: RELENG_4 on flash disk and swap
> I'm running FreeBSD in 64Mb with no swap and it works fine. A few
> sysctls that I've found helpful for running without swap:
> vm.swap_enabled=0
> vm.disable_swapspace_pageouts=1
> kern.ipc.shm_use_phys=1

   Thank you very much! These settings (rather vm.disable_swapspace_pageouts, 
because I've already had vm.swap_enabled=0, and IMHO kern.ipc.shm_use_phys
matters for specific applications only) have taken my dreadful

swap_pager_getswapspace: failed

messages away! Now I can run "make buildworld/buildkernel" and build some 
other ports simultaneously, and swap_pager doesn't complain. I think that
this piece of wisdom (sysctl settings for swapless FreeBSD) is definitely 
worth being mentioned in tuning(7).

   Actually 'top' shows on my swapless machine with 256Mb RAM that there are
always a lot of usable pages (Inact + Free almost always > 150Mb). So swap
attempts before turning vm.disable_swapspace_pageouts on had an artifical 
nature (wasn't necessary at all)?

On Sat, 4 Mar 2006, Peter Jeremy wrote:
> Once you've received this message, the OS is free to kill your
> processes until it frees up some swap (which it can't do if you don't
> have any).  I suggest you have a quick look through vm/swap_pager.c
> and vm/vm_pageout.c, looking at swap_pager_full and swap_pager_almost_full.

  This is still a concern for me. IMHO it would be useful to have the ability
to disable process killing due to the lack of swap, because having this
enabled on e.g. transit router can lead to very unpleasant scenario. Imagine 
someone DoS-attacks it's sshd, and kernel kills the process with the largest 
RSS - it could e.g. be a vital part of the routing software (zebra/ripd/bgpd), 
and killing this process will render our router unreachable and unusable!

Sincerely, Dmitry
Atlantis ISP, System Administrator
e-mail:  dmitry at
nic-hdl: LYNX-RIPE

More information about the freebsd-stable mailing list