From f558685afabcc4d24aef8ee4239cef284249027d Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Thu, 29 Jan 2009 14:25:09 -0800 Subject: [PATCH] --- yaml --- r: 130379 b: refs/heads/master c: 9e9e3cbc62da43c66e894d5a61fa08b427e25202 h: refs/heads/master i: 130377: c1cd8f9db40970bf3abeb515ddf78392d4e45cd4 130375: 9e041a2ed7319556ba88d8b294c2ba1827185a0a v: v3 --- [refs] | 2 +- trunk/Documentation/filesystems/proc.txt | 28 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ff79cb24ccf8..42f6de612d5e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dc19835df6c47ff676ad6c98722d5e529db5d74c +refs/heads/master: 9e9e3cbc62da43c66e894d5a61fa08b427e25202 diff --git a/trunk/Documentation/filesystems/proc.txt b/trunk/Documentation/filesystems/proc.txt index bbebc3a43ac0..a87be42f8211 100644 --- a/trunk/Documentation/filesystems/proc.txt +++ b/trunk/Documentation/filesystems/proc.txt @@ -2027,6 +2027,34 @@ increase the likelihood of this process being killed by the oom-killer. Valid values are in the range -16 to +15, plus the special value -17, which disables oom-killing altogether for this process. +The process to be killed in an out-of-memory situation is selected among all others +based on its badness score. This value equals the original memory size of the process +and is then updated according to its CPU time (utime + stime) and the +run time (uptime - start time). The longer it runs the smaller is the score. +Badness score is divided by the square root of the CPU time and then by +the double square root of the run time. + +Swapped out tasks are killed first. Half of each child's memory size is added to +the parent's score if they do not share the same memory. Thus forking servers +are the prime candidates to be killed. Having only one 'hungry' child will make +parent less preferable than the child. + +/proc//oom_score shows process' current badness score. + +The following heuristics are then applied: + * if the task was reniced, its score doubles + * superuser or direct hardware access tasks (CAP_SYS_ADMIN, CAP_SYS_RESOURCE + or CAP_SYS_RAWIO) have their score divided by 4 + * if oom condition happened in one cpuset and checked task does not belong + to it, its score is divided by 8 + * the resulting score is multiplied by two to the power of oom_adj, i.e. + points <<= oom_adj when it is positive and + points >>= -(oom_adj) otherwise + +The task with the highest badness score is then selected and its children +are killed, process itself will be killed in an OOM situation when it does +not have children or some of them disabled oom like described above. + 2.13 /proc//oom_score - Display current oom-killer score -------------------------------------------------------------