Memory overcomitting in Linux kernel

Stefan Fiedler <e0155490-oe7qfRrRQffzPE21tAIdciO7C/[email protected]> Fri, 11 May 2007 11:34:00 +0200
Newsgroups gmane.linux.distributions.rock.devel
Message-ID <[email protected]>
Hi all,

regarding the patch 2006112819464228950:
> Stefan Fiedler:
>         disable kernel memory overcommitting behaviour at boot-up
>         via sysctl; this fixes a kernel bug, see man 3 malloc
>         section BUGS for details.
>
>
> by clifford
> If you really think that is a kernel bug you should discuss this on the
> linux kernel mailing list and suggest changing the
>
>   int sysctl_overcommit_memory = OVERCOMMIT_GUESS;
>
> in <kernel-source>/mm/mmap.c to something like
>
>   int sysctl_overcommit_memory = OVERCOMMIT_NEVER;
>
> however, I'd say there is a good reasonon that the whole OVERCOMMIT_GUESS
> has been written in the first place and it is imo a bad idea to change that
> to OVERCOMMIT_NEVER in a general purpose distribution.

Imo clean program termination (with OVERCOMMIT_NEVER) is better than seemingly 
random trashing when there's not enough virtual memory. All it takes it to 
allocate enough swap space in the first place. Ymmv, though.
On systems with very limited virtual memory, the default behaviour would allow 
to allocate more memory than really exists, but the risk of trashing would be 
even bigger. So I'd say having the safer option as the default is actually 
better.

With best regards,
	Stefan Fiedler