VM strict overcommit on RedHat AS 2.1 kernel 2.4.18-e12 ?
Quoted 4 lines · Thierry
I know that Alan Cox has a patch and that a lot of job is currently done in kernel 2.5 .
This patch is partially integrated in the kernel 2.4.18-e12 delivered with the RedHat Advanced Server 2.1.
But there is a difference between the documentation aboutovercommit_memoryinsysctl/vm.txtand the code really implemented inmm/mmap.cIs there any reason for that ?
What differences are you seeing between the documentation and the code?
Bill
Hi,
in the file : Documentation/vm/overcommit-accounting :
The Linux kernel supports four overcommit handling modes
0 - Heuristic overcommit handling. Obvious overcommits of
address space are refused. Used for a typical system. It ensures a seriously wild allocation fails while allowing overcommit to reduce swap usage
1 - No overcommit handling. Appropriate for some scientific
applications
2 - (NEW) strict overcommit. The total address space commit
for the system is not permitted to exceed swap + half ram. In almost all situations this means a process will not be killed while accessing pages but only by malloc failures that are reported back by the kernel mmap/brk code.
3 - (NEW) paranoid overcommit The total address space commit
for the system is not permitted to exceed swap. The machine will never kill a process accessing pages it has mapped except due to a bug (ie report it!)
in the source code : mm/mmap.c
int vm_enough_memory(long pages, int charge)
{
/* Stupid algorithm to decide if we have enough memory: while
* simple, it hopefully works in most obvious cases.. Easy to
* fool it, but this should catch most mistakes.
*
* 23/11/98 NJC: Somewhat less stupid version of algorithm,
* which tries to do "TheRightThing". Instead of using half of
* (buffers+cache), use the minimum values. Allow an extra 2%
* of num_physpages for safety margin.
*
* 2002/02/26 Alan Cox: Added two new modes that do real accounting
*/
unsigned long free, allowed;
struct sysinfo i;
if(charge)
atomic_add(pages, &vm_committed_space);
/* Sometimes we want to use more memory than we have. */
if (sysctl_overcommit_memory == 1)
return 1;
if (sysctl_overcommit_memory == 0)
{
.....
}
if(sysctl_overcommit_memory == 2)
{
/* FIXME - need to add arch hooks to get the bits we need
without the higher overhead crap */
si_meminfo(&i);
allowed += i.totalram >> 1;
}
if(atomic_read(&vm_committed_space) < allowed)
return 1;
if(charge)
atomic_sub(pages, &vm_committed_space);
return 0;}
Regards,
Thierry
PS: Unfortunatelly I will be out of office until the 3rd Febuary with no access to my mail box.
-----Message d'origine-----
De : Bill Nottingham [mailto:[email protected]]
Envoyé : lundi 27 janvier 2003 17:36
À : Carron, Thierry
Cc : [email protected]
Objet : [Linux-ia64] Re: VM strict overcommit on RedHat AS 2.1 kernel 2.4.18-e12 ?
Quoted 4 lines · Thierry
I know that Alan Cox has a patch and that a lot of job is currently done in kernel 2.5 .
This patch is partially integrated in the kernel 2.4.18-e12 delivered with the RedHat Advanced Server 2.1.
But there is a difference between the documentation aboutovercommit_memoryinsysctl/vm.txtand the code really implemented inmm/mmap.cIs there any reason for that ?
What differences are you seeing between the documentation and the code?
Bill
_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64