From b0ba70df83c9460ddf8bdea19b452bcfb9889c60 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 5 Sep 2003 02:54:09 +0000 Subject: [PATCH] Update information about Linux's overcommit memory behavior. Andrew Dunstan --- doc/src/sgml/runtime.sgml | 59 +++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index d74cf993d9..eabc67c646 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -3081,14 +3081,61 @@ kernel.shmmax = 134217728 - Linux has poor default memory overcommit behavior. Rather than - failing if it can not reserve enough memory, it returns success, - but later fails when the memory can't be mapped and terminates - the application with kill -9. To prevent unpredictable - process termination, use: + Linux kernel version 2.4.* has poor default memory overcommit + behavior, which can result in the postmaster being killed by the + kernel due to memory demands by another process if the system + runs out of memory. + + + + The symptom of this occuring is a kernel message looking like + this (consult your system documentation and configuration on + where to look for such a message): + + Out of Memory: Killed process 12345 (postmaster). + + + + + To avoid this situation, run PostgreSQL + on a machine where you + can be sure that other processes will not run the machine out + of memory. If your kernel supports strict and/or paranoid modes + of overcommit handling, you can also relieve this problem by + altering the system's default behaviour. This can be determined + by examining the function vm_enough_memory + in the file mm/mmap.cin the kernel source. + If this file reveals that strict and/or paranoid modes are + supported by your kernel, turn one of these modes on by using + +sysctl -w vm.overcommit_memory=2 + + for strict mode or sysctl -w vm.overcommit_memory=3 + for paranoid mode, or placing an equivalent entry in + /etc/sysctl.conf. + + + + + Warning: using these settings in a kernel which does not support + these modes will almost certainly increase the danger of the + kernel killing the postmaster, rather than reducing it. + If in any doubt, consult a kernel expert or your kernel vendor. + + + + + These modes are expected to be supported in all 2.6 and later + kernels. Some vendor 2.4 kernels may also support these modes. + However, it is known that some vendor documents suggest that + they support them while examination of the kernel source reveals + that they do not. + + + Note, you will need enough swap space to cover all your memory needs. -- 2.40.0