[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Swapper problems?

On Mon, Aug 24, 2009 at 11:49:52AM +0100, David Given wrote:
> Jason Edgecombe wrote:
> [...]
> > Try running the following as root:
> > sysctl -w overcommit_memory=2
> > sysctl -w overcommit_ratio=95
> Thanks --- although there's a typo; just for reference, you mean:
> sysctl -w vm.overcommit_memory=2
> sysctl -w vm.overcommit_ratio=95

You really, *really* don't want to set your overcommit ratio to 95... you
can very easily starve the kernel of memory (which, as you'd expect, it kind
of a bad thing).  I've had problems with any setting greater than 80, so I
just leave it at the default (50) and give myself more swap if I need it.

> Although if I've understood things correctly, this will tell me system
> to behave as if it's actually got 2GB of RAM (512MB RAM + 1GB swap +
> (1*0.95) GB of overcommit).

Not quite.  It's 1GB swap + 0.95 * 512MB = ~1.45GB.

> Why would this help? Wouldn't I rather
> disable overcommit completely to ensure that if apps successfully
> allocate memory, then they can always access it?

Well, overcommit_memory=2 *is* turning off overcommit; the (slightly
misnamed) overcommit_ratio just gives the kernel a baseline for working out
when it might be getting to the overcommit point.

- Matt

Reply to: