[Cialug] Mitigating runaway swap with a vm.conf tweak?

Nathan Stien nathanism at gmail.com
Fri Sep 5 13:30:47 CDT 2008


Howdy Luggers,

I happened upon a blog post that talks about changing a couple of
settings in /etc/sysctl.d/vm.conf to get better behavior when you have
a runaway process grabbing all of your RAM, making your machine
unresponsive:

https://www.joachim-breitner.de/blog/archives/303-vm.overcommit_memory-2,-vm.overcommit_ratio-0.html

He sets his overcommit ratio to zero, in order to "make sure that it
only hands out (swap size + 0 * RAM size) to processes," with the
proviso that your swap size approximates your physical RAM size.  The
idea is that you can still get the benefits of swap (little-used pages
get swapped out so the OS can use that physical memory for file
buffers), without a buggy program being able to malloc() your box to
death.

I wanted to poll the collective wisdom of the LUG to get some opinions
on the idea.  The author himself is also looking for better ways to do
this.

I anticipate some of you will just say "don't use swap!", but I prefer
to have swap on a desktop/laptop system.  (I am less attached to it on
servers.)

- Nathan


More information about the Cialug mailing list