From: "M.H.VanLeeuwen" <vanl@megsinet.net>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Andrea Arcangeli <andrea@suse.de>,
davej@suse.de, linux-kernel@vger.kernel.org
Subject: [PATCH] - Taming OOM killer, 2.4.17-rc1
Date: Fri, 14 Dec 2001 20:25:56 -0600 [thread overview]
Message-ID: <3C1AB4B4.A24A0A5@megsinet.net> (raw)
In-Reply-To: <20011212094246.O4801@athlon.random>
[-- Attachment #1: Type: text/plain, Size: 15064 bytes --]
Hi Marcelo,
I tested your VM changes in rc1 and it still "feels" wrong...subjective;)
Dave pointed out in a previous thread that the OOM killer has been over
enthusiastic on his boxes, same here.
The attached patch changes the attributes of the out_of_memory function to:
1. wait longer before attempting to kill processes; "MB of cache" seconds.
2. OOM occurrences must be 10*(MB of cache) once "1." is satisfied.
This allows the system to be less likely to kill processes when there is still cache
memory available, i.e. the OOM killer is dynamic based on the system cache size.
We probably should be killing processes without a least first shrinking cache size
somewhat first. It would be much better to have processes run at the expense of
cache than the other way around, i.e.. a predictably slow system due to low memory
thus little cache is better than a fast system that unpredictably keeps killing
processes because large amount of memory are held in cache.
The DEBUG output below is just from compiling kdebase, w/o this OOM killer taming my
system fail to compile most large packages. That has been true since OOM killer
was re-enable in the 2.4.X series sometime after the 2.4.10 VM changes.
(also running 1 setiathome, kde desktop and other minor small apps)
Dual C-466, 192M RAM, no swap.
Below is the DEBUG output from my change that shows the system failing to release
page cache for quite sometime. I split up the output for easier reading.
There are also long pauses (display/mouse freezes) in the system when this is happening.
I realize this patch is just chasing a symptom, but it is self tuning so seems to
be a good change regardless. Yes, it still kills ;) (patch attached as binary file)
Martin
This is: Cache size, Time in Seconds since first OOM report,
restarted if > 5 seconds since the
last OOM report.
out_of_memory: cache size 17 Mb, since = 0.80
out_of_memory: cache size 17 Mb, since = 1.15
out_of_memory: cache size 17 Mb, since = 1.19
out_of_memory: cache size 17 Mb, since = 2.64
out_of_memory: cache size 17 Mb, since = 3.14
out_of_memory: cache size 17 Mb, since = 3.20
out_of_memory: cache size 17 Mb, since = 3.26
out_of_memory: cache size 17 Mb, since = 3.27
out_of_memory: cache size 17 Mb, since = 3.67
out_of_memory: cache size 17 Mb, since = 4.42 << Previous system would have killed a process
out_of_memory: cache size 17 Mb, since = 4.44 and we haven't even touched the cache size.
out_of_memory: cache size 16 Mb, since = 5.19
out_of_memory: cache size 16 Mb, since = 5.52
out_of_memory: cache size 16 Mb, since = 5.76
out_of_memory: cache size 15 Mb, since = 6.79
out_of_memory: cache size 15 Mb, since = 8.04
out_of_memory: cache size 14 Mb, since = 8.20
---------------------------------------------------------------
out_of_memory: cache size 10 Mb, since = 1.91
out_of_memory: cache size 8 Mb, since = 6.81
out_of_memory: cache size 8 Mb, since = 6.83
---------------------------------------------------------------
out_of_memory: cache size 45 Mb, since = 1.31
out_of_memory: cache size 45 Mb, since = 2.23
out_of_memory: cache size 45 Mb, since = 2.30
out_of_memory: cache size 45 Mb, since = 2.38
out_of_memory: cache size 45 Mb, since = 3.43
out_of_memory: cache size 45 Mb, since = 3.56
out_of_memory: cache size 45 Mb, since = 3.67
out_of_memory: cache size 45 Mb, since = 3.67
out_of_memory: cache size 45 Mb, since = 3.73
out_of_memory: cache size 45 Mb, since = 3.78 << Previous system would have killed a process
out_of_memory: cache size 45 Mb, since = 3.82
out_of_memory: cache size 45 Mb, since = 3.84
out_of_memory: cache size 45 Mb, since = 3.93
out_of_memory: cache size 44 Mb, since = 5.02
out_of_memory: cache size 44 Mb, since = 5.03
out_of_memory: cache size 44 Mb, since = 5.04
out_of_memory: cache size 44 Mb, since = 5.11
out_of_memory: cache size 44 Mb, since = 5.31
out_of_memory: cache size 44 Mb, since = 7.05
out_of_memory: cache size 44 Mb, since = 7.12
--------------------------------------------------------------------
out_of_memory: cache size 41 Mb, since = 0.06
out_of_memory: cache size 41 Mb, since = 0.11
out_of_memory: cache size 41 Mb, since = 0.74
out_of_memory: cache size 41 Mb, since = 0.83
out_of_memory: cache size 40 Mb, since = 1.29
out_of_memory: cache size 40 Mb, since = 1.48
out_of_memory: cache size 40 Mb, since = 1.57
out_of_memory: cache size 40 Mb, since = 2.37
out_of_memory: cache size 40 Mb, since = 2.40
out_of_memory: cache size 40 Mb, since = 2.43 << and here
out_of_memory: cache size 40 Mb, since = 2.54
out_of_memory: cache size 40 Mb, since = 2.58
out_of_memory: cache size 40 Mb, since = 2.85
out_of_memory: cache size 40 Mb, since = 4.35
out_of_memory: cache size 40 Mb, since = 4.40
out_of_memory: cache size 40 Mb, since = 4.63
out_of_memory: cache size 40 Mb, since = 4.77
out_of_memory: cache size 40 Mb, since = 5.12
out_of_memory: cache size 40 Mb, since = 5.33
out_of_memory: cache size 40 Mb, since = 5.49
out_of_memory: cache size 40 Mb, since = 5.54
out_of_memory: cache size 40 Mb, since = 5.55
out_of_memory: cache size 40 Mb, since = 5.97
out_of_memory: cache size 40 Mb, since = 6.26
out_of_memory: cache size 40 Mb, since = 6.62
out_of_memory: cache size 40 Mb, since = 6.92
out_of_memory: cache size 40 Mb, since = 7.17
out_of_memory: cache size 40 Mb, since = 7.50
out_of_memory: cache size 40 Mb, since = 7.74
out_of_memory: cache size 40 Mb, since = 7.85
out_of_memory: cache size 40 Mb, since = 8.21
out_of_memory: cache size 40 Mb, since = 8.81
out_of_memory: cache size 40 Mb, since = 8.85
out_of_memory: cache size 40 Mb, since = 8.92
out_of_memory: cache size 40 Mb, since = 9.07
out_of_memory: cache size 40 Mb, since = 9.47
out_of_memory: cache size 40 Mb, since = 9.81
out_of_memory: cache size 40 Mb, since = 9.84
out_of_memory: cache size 40 Mb, since = 9.94
out_of_memory: cache size 40 Mb, since = 10.49
out_of_memory: cache size 40 Mb, since = 10.80
out_of_memory: cache size 40 Mb, since = 10.81
out_of_memory: cache size 40 Mb, since = 10.88
out_of_memory: cache size 40 Mb, since = 11.40
out_of_memory: cache size 40 Mb, since = 11.77
out_of_memory: cache size 40 Mb, since = 11.81
out_of_memory: cache size 40 Mb, since = 11.81
out_of_memory: cache size 40 Mb, since = 12.01
out_of_memory: cache size 40 Mb, since = 12.04
out_of_memory: cache size 40 Mb, since = 12.24
out_of_memory: cache size 40 Mb, since = 12.60
out_of_memory: cache size 40 Mb, since = 12.90
out_of_memory: cache size 40 Mb, since = 12.94
out_of_memory: cache size 40 Mb, since = 13.40
out_of_memory: cache size 40 Mb, since = 13.55
out_of_memory: cache size 40 Mb, since = 14.16
out_of_memory: cache size 40 Mb, since = 14.16
out_of_memory: cache size 40 Mb, since = 14.16
out_of_memory: cache size 40 Mb, since = 14.26
out_of_memory: cache size 40 Mb, since = 14.27
out_of_memory: cache size 40 Mb, since = 14.81
out_of_memory: cache size 40 Mb, since = 14.88
out_of_memory: cache size 40 Mb, since = 15.43
out_of_memory: cache size 40 Mb, since = 15.58
out_of_memory: cache size 40 Mb, since = 15.79
out_of_memory: cache size 40 Mb, since = 16.28
out_of_memory: cache size 40 Mb, since = 16.44
out_of_memory: cache size 40 Mb, since = 16.48
out_of_memory: cache size 40 Mb, since = 16.93
out_of_memory: cache size 40 Mb, since = 17.02
out_of_memory: cache size 40 Mb, since = 17.12
out_of_memory: cache size 40 Mb, since = 17.76
out_of_memory: cache size 40 Mb, since = 17.80
out_of_memory: cache size 40 Mb, since = 17.87
out_of_memory: cache size 40 Mb, since = 18.01
out_of_memory: cache size 40 Mb, since = 18.29
out_of_memory: cache size 40 Mb, since = 18.46
out_of_memory: cache size 40 Mb, since = 18.48
out_of_memory: cache size 40 Mb, since = 18.50
out_of_memory: cache size 40 Mb, since = 18.70
out_of_memory: cache size 40 Mb, since = 19.21
out_of_memory: cache size 40 Mb, since = 19.27
out_of_memory: cache size 40 Mb, since = 19.46
out_of_memory: cache size 40 Mb, since = 19.56
out_of_memory: cache size 40 Mb, since = 19.91
out_of_memory: cache size 40 Mb, since = 20.07
out_of_memory: cache size 40 Mb, since = 20.71
out_of_memory: cache size 40 Mb, since = 20.86
out_of_memory: cache size 40 Mb, since = 21.43
out_of_memory: cache size 40 Mb, since = 21.58
out_of_memory: cache size 40 Mb, since = 21.78
out_of_memory: cache size 40 Mb, since = 21.98
out_of_memory: cache size 40 Mb, since = 22.00
out_of_memory: cache size 40 Mb, since = 22.11
out_of_memory: cache size 40 Mb, since = 22.67
out_of_memory: cache size 40 Mb, since = 22.78
out_of_memory: cache size 40 Mb, since = 22.84
out_of_memory: cache size 40 Mb, since = 22.95
out_of_memory: cache size 40 Mb, since = 22.98
out_of_memory: cache size 40 Mb, since = 23.05
out_of_memory: cache size 40 Mb, since = 23.18
out_of_memory: cache size 40 Mb, since = 23.18
out_of_memory: cache size 40 Mb, since = 23.32
out_of_memory: cache size 40 Mb, since = 23.53
out_of_memory: cache size 40 Mb, since = 23.60
out_of_memory: cache size 40 Mb, since = 23.69
out_of_memory: cache size 40 Mb, since = 24.03
out_of_memory: cache size 40 Mb, since = 24.06
out_of_memory: cache size 40 Mb, since = 24.17
out_of_memory: cache size 40 Mb, since = 24.40
out_of_memory: cache size 40 Mb, since = 24.52
out_of_memory: cache size 40 Mb, since = 24.79
out_of_memory: cache size 40 Mb, since = 27.42
out_of_memory: cache size 40 Mb, since = 27.73
out_of_memory: cache size 40 Mb, since = 27.86
out_of_memory: cache size 40 Mb, since = 28.14
out_of_memory: cache size 40 Mb, since = 28.25
out_of_memory: cache size 40 Mb, since = 28.28
out_of_memory: cache size 40 Mb, since = 28.68
out_of_memory: cache size 40 Mb, since = 28.73
out_of_memory: cache size 40 Mb, since = 29.43
out_of_memory: cache size 40 Mb, since = 29.46
out_of_memory: cache size 40 Mb, since = 29.52
out_of_memory: cache size 40 Mb, since = 30.04
out_of_memory: cache size 40 Mb, since = 30.41
out_of_memory: cache size 40 Mb, since = 30.78 << ~29 SECONDS AND NO CACHE SHRINKAGE!!??!! ***
out_of_memory: cache size 39 Mb, since = 31.11
out_of_memory: cache size 39 Mb, since = 31.25
out_of_memory: cache size 39 Mb, since = 31.34
out_of_memory: cache size 39 Mb, since = 31.44
out_of_memory: cache size 39 Mb, since = 31.63
-----------------------------------------------------------
out_of_memory: cache size 19 Mb, since = 1.30
out_of_memory: cache size 19 Mb, since = 3.38
out_of_memory: cache size 19 Mb, since = 4.40
out_of_memory: cache size 18 Mb, since = 5.11
out_of_memory: cache size 18 Mb, since = 5.66
out_of_memory: cache size 18 Mb, since = 6.01
out_of_memory: cache size 18 Mb, since = 6.08
out_of_memory: cache size 18 Mb, since = 6.14
out_of_memory: cache size 18 Mb, since = 6.81
out_of_memory: cache size 18 Mb, since = 6.89 << and here
out_of_memory: cache size 18 Mb, since = 6.89
out_of_memory: cache size 18 Mb, since = 7.77
out_of_memory: cache size 18 Mb, since = 8.00
out_of_memory: cache size 18 Mb, since = 8.00
out_of_memory: cache size 18 Mb, since = 8.46
out_of_memory: cache size 18 Mb, since = 8.57
out_of_memory: cache size 18 Mb, since = 8.66
out_of_memory: cache size 18 Mb, since = 8.71
out_of_memory: cache size 18 Mb, since = 9.30
out_of_memory: cache size 18 Mb, since = 9.65
out_of_memory: cache size 18 Mb, since = 9.80
out_of_memory: cache size 18 Mb, since = 9.93
out_of_memory: cache size 18 Mb, since = 10.51
out_of_memory: cache size 18 Mb, since = 10.92
out_of_memory: cache size 18 Mb, since = 11.00
out_of_memory: cache size 18 Mb, since = 11.15
out_of_memory: cache size 18 Mb, since = 11.28
out_of_memory: cache size 18 Mb, since = 11.38
out_of_memory: cache size 18 Mb, since = 11.40
out_of_memory: cache size 18 Mb, since = 11.65
out_of_memory: cache size 18 Mb, since = 11.72
out_of_memory: cache size 18 Mb, since = 11.75
out_of_memory: cache size 18 Mb, since = 12.21
out_of_memory: cache size 18 Mb, since = 12.46
out_of_memory: cache size 18 Mb, since = 12.56
out_of_memory: cache size 18 Mb, since = 12.89
out_of_memory: cache size 18 Mb, since = 13.36
out_of_memory: cache size 18 Mb, since = 13.77
out_of_memory: cache size 18 Mb, since = 14.04
out_of_memory: cache size 18 Mb, since = 14.23
out_of_memory: cache size 18 Mb, since = 14.46
out_of_memory: cache size 18 Mb, since = 14.58
out_of_memory: cache size 18 Mb, since = 14.60
out_of_memory: cache size 18 Mb, since = 14.61
out_of_memory: cache size 18 Mb, since = 14.67
out_of_memory: cache size 18 Mb, since = 14.92
out_of_memory: cache size 18 Mb, since = 15.24
out_of_memory: cache size 18 Mb, since = 15.36
out_of_memory: cache size 18 Mb, since = 15.43
out_of_memory: cache size 18 Mb, since = 16.06
out_of_memory: cache size 18 Mb, since = 16.51
out_of_memory: cache size 18 Mb, since = 16.63
out_of_memory: cache size 18 Mb, since = 16.68
out_of_memory: cache size 18 Mb, since = 16.74
out_of_memory: cache size 18 Mb, since = 16.75
out_of_memory: cache size 18 Mb, since = 17.60
out_of_memory: cache size 18 Mb, since = 17.98
------------------------------------------------------------------------------
out_of_memory: cache size 59 Mb, since = 2.09
out_of_memory: cache size 59 Mb, since = 2.32
out_of_memory: cache size 59 Mb, since = 2.44
out_of_memory: cache size 57 Mb, since = 3.50
out_of_memory: cache size 57 Mb, since = 3.52
out_of_memory: cache size 57 Mb, since = 3.94
out_of_memory: cache size 56 Mb, since = 4.97
out_of_memory: cache size 56 Mb, since = 5.13
out_of_memory: cache size 56 Mb, since = 5.20
out_of_memory: cache size 56 Mb, since = 5.28 << and here
out_of_memory: cache size 56 Mb, since = 5.28
out_of_memory: cache size 55 Mb, since = 6.40
out_of_memory: cache size 55 Mb, since = 6.66
out_of_memory: cache size 54 Mb, since = 9.09
out_of_memory: cache size 54 Mb, since = 9.11
out_of_memory: cache size 54 Mb, since = 9.17
out_of_memory: cache size 54 Mb, since = 9.30
out_of_memory: cache size 54 Mb, since = 9.65
out_of_memory: cache size 54 Mb, since = 9.67
-----------------------------------------------------------------
out_of_memory: cache size 47 Mb, since = 0.67
out_of_memory: cache size 47 Mb, since = 0.86
out_of_memory: cache size 47 Mb, since = 0.91
out_of_memory: cache size 47 Mb, since = 0.91
out_of_memory: cache size 47 Mb, since = 0.95
out_of_memory: cache size 47 Mb, since = 0.96
out_of_memory: cache size 47 Mb, since = 1.22
out_of_memory: cache size 46 Mb, since = 2.13
out_of_memory: cache size 46 Mb, since = 2.25
out_of_memory: cache size 46 Mb, since = 2.32 << etc
out_of_memory: cache size 46 Mb, since = 2.37
out_of_memory: cache size 46 Mb, since = 2.53
out_of_memory: cache size 46 Mb, since = 2.58
out_of_memory: cache size 46 Mb, since = 2.59
out_of_memory: cache size 46 Mb, since = 2.67
out_of_memory: cache size 46 Mb, since = 2.69
out_of_memory: cache size 46 Mb, since = 4.35
out_of_memory: cache size 46 Mb, since = 4.67
out_of_memory: cache size 46 Mb, since = 4.91
out_of_memory: cache size 46 Mb, since = 4.91
out_of_memory: cache size 45 Mb, since = 5.62
out_of_memory: cache size 44 Mb, since = 8.21
[-- Attachment #2: oom_kill.c.patch2.4.17rc1 --]
[-- Type: application/octet-stream, Size: 1178 bytes --]
--- oom_kill.c.orig Wed Dec 12 22:16:06 2001
+++ oom_kill.c Thu Dec 13 22:31:01 2001
@@ -22,6 +22,7 @@
#include <linux/timex.h>
/* #define DEBUG */
+#define DEBUG1
/**
* int_sqrt - oom_kill.c internal function, rough approximation to sqrt
@@ -200,6 +201,7 @@
{
static unsigned long first, last, count;
unsigned long now, since;
+ int mega;
/*
* Enough swap space left? Not OOM.
@@ -215,23 +217,30 @@
* If it's been a long time since last failure,
* we're not oom.
*/
- last = now;
+
if (since > 5*HZ)
goto reset;
/*
- * If we haven't tried for at least one second,
+ * If we haven't tried for at least mega*seconds,
* we're not really oom.
+ * Where mega is the number of megabytes of outstanding cache.
*/
+
+ mega = atomic_read(&page_cache_size) >> (20 - PAGE_SHIFT);
since = now - first;
- if (since < HZ)
+ if (since < mega * HZ) {
+#ifdef DEBUG1
+ printk(KERN_DEBUG "out_of_memory: cache size %d Mb, since = %lu.%02lu\n",mega, since/HZ, since%HZ);
+#endif
return;
+ }
/*
* If we have gotten only a few failures,
* we're not really oom.
*/
- if (++count < 10)
+ if (++count < mega * 10)
return;
/*
next parent reply other threads:[~2001-12-15 2:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20011212094246.O4801@athlon.random>
2001-12-15 2:25 ` M.H.VanLeeuwen [this message]
2002-01-12 1:13 ` [PATCH] - Taming OOM killer, 2.4.17-rc1 Denis Vlasenko
2002-01-12 0:22 ` M.H.VanLeeuwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3C1AB4B4.A24A0A5@megsinet.net \
--to=vanl@megsinet.net \
--cc=andrea@suse.de \
--cc=davej@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox