Re: 2.2/2.4/2.6 VMs: do malloc() ever return NULL?

From: Ihar 'Philips' Filipau
Date: Tue Nov 25 2003 - 14:06:00 EST


Rik van Riel wrote:
On Tue, 25 Nov 2003, Ihar 'Philips' Filipau wrote:

2.6: the same as 2.4 with oom killer (default conf). I have no test
system to check 2.6. w/o oom killer.


# echo 2 > /proc/sys/vm/overcommit_memory

Then try again.


What do you know what is not said in docs?
What '2' means?

I'll try as soon as I will have again access to 2.6 box.

this is what 2.6-test10 says:

overcommit_memory

This file contains one value. The following algorithm is used to
decide if there's enough memory: if the value of
overcommit_memory is positive, then there's always enough memory.
This is a useful feature, since programs often malloc() huge amounts
of memory 'just in case', while they only use a small part of it.
Leaving this value at 0 will lead to the failure of such a huge malloc(), when in fact the system has enough memory for the program
to run.

On the other hand, enabling this feature can cause you to run out
of memory and thrash the system to death, so large and/or important
servers will want to set this value to 0.

Could this special case 'sysctl_overcommit_memory > 1' be added and explained? (mmap.c:589)

I cannot tell what it does - but name 'security_vm_enough_memory()' sounds promising ;-)

As I have said - I will check this later when I will get to those box.

--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
Because the kernel depends on it existing. "init" |_|*|_|
literally _is_ special from a kernel standpoint, |_|_|*|
because its' the "reaper of zombies" (and, may I add, |*|*|*|
that would be a great name for a rock band).
-- Linus Torvalds

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/