From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Peter Bergmann <bergmann.peter@gmx.net>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
<linux-kernel@vger.kernel.org>, <nfedera@esesix.at>,
<andrea@suse.de>, <riel@redhat.com>
Subject: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
Date: Mon, 8 Dec 2003 15:15:48 -0200 (BRST) [thread overview]
Message-ID: <Pine.LNX.4.44.0312081512510.1289-100000@logos.cnet> (raw)
In-Reply-To: <16204.1070665738@www29.gmx.net>
On Sat, 6 Dec 2003, Peter Bergmann wrote:
> > > If anyone is interested:
> > > Norbert Federa sent me this link for a "quick&dirty" patch he made
> > > for 2.4.23-vanilla which rolls back the complete 2.4.22 vm including the
> > > old oom-killer - without guarantee but it does work very well for me
> > ...
> >
> > I suppose the oom killer is the only reason for you using .22 VM correct?
> >
> > Or do you have any other reason for this?
>
> No, you're right. The oom killer is the _only_reason.
> I did not succeed in integrating the disabled oom_kill.c in 2.4.23.
> The only solution for me is applying Norbert's .22vm patch.
Hi,
The following patch makes OOM killer configurable (its the same as the
other patches posted except its around CONFIG_OOM_KILLER).
I hope the Configure.help entry is clear enough.
Peter, can you please try this.
Comments are appreciated.
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/Documentation/Configure.help linux-2.4.24/Documentation/Configure.help
--- linux-2.4.24.orig/Documentation/Configure.help 2003-12-08 14:18:51.000000000 +0000
+++ linux-2.4.24/Documentation/Configure.help 2003-12-08 16:57:30.000000000 +0000
@@ -412,6 +412,20 @@
Otherwise low memory pages are used as bounce buffers causing a
degrade in performance.
+OOM killer support
+CONFIG_OOM_KILLER
+ This option selects the kernel behaviour during total out of memory
+ condition.
+
+ The default behaviour is to, as soon as no freeable memory and no swap
+ space are available, kill the task which tries to allocate memory.
+ The default behaviour is very reliable.
+
+ If you select this option, as soon as no freeable memory is available,
+ the kernel will try to select the "best" task to be killed.
+
+ If unsure, say N.
+
Normal floppy disk support
CONFIG_BLK_DEV_FD
If you want to use the floppy disk drive(s) of your PC under Linux,
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/arch/i386/config.in linux-2.4.24/arch/i386/config.in
--- linux-2.4.24.orig/arch/i386/config.in 2003-12-08 14:15:26.000000000 +0000
+++ linux-2.4.24/arch/i386/config.in 2003-12-08 16:27:43.000000000 +0000
@@ -328,6 +328,7 @@
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
bool 'Power Management support' CONFIG_PM
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/include/linux/sched.h linux-2.4.24/include/linux/sched.h
--- linux-2.4.24.orig/include/linux/sched.h 2003-12-08 14:16:11.000000000 +0000
+++ linux-2.4.24/include/linux/sched.h 2003-12-08 17:01:56.000000000 +0000
@@ -429,6 +429,7 @@
#define PF_DUMPCORE 0x00000200 /* dumped core */
#define PF_SIGNALED 0x00000400 /* killed by a signal */
#define PF_MEMALLOC 0x00000800 /* Allocating memory */
+#define PF_MEMDIE 0x00001000 /* Killed for out-of-memory */
#define PF_FREE_PAGES 0x00002000 /* per process page freeing */
#define PF_NOIO 0x00004000 /* avoid generating further I/O */
#define PF_FSTRANS 0x00008000 /* inside a filesystem transaction */
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/mm/oom_kill.c linux-2.4.24/mm/oom_kill.c
--- linux-2.4.24.orig/mm/oom_kill.c 2003-12-08 14:18:51.000000000 +0000
+++ linux-2.4.24/mm/oom_kill.c 2003-12-08 15:49:56.000000000 +0000
@@ -21,8 +21,6 @@
#include <linux/swapctl.h>
#include <linux/timex.h>
-#if 0 /* Nothing in this file is used */
-
/* #define DEBUG */
/**
@@ -153,6 +151,7 @@
* exit() and clear out its resources quickly...
*/
p->counter = 5 * HZ;
+ p->flags |= PF_MEMALLOC | PF_MEMDIE;
/* This process has hardware access, be more careful. */
if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO)) {
@@ -271,5 +270,3 @@
out_unlock:
spin_unlock(&oom_lock);
}
-
-#endif /* Unused file */
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/mm/page_alloc.c linux-2.4.24/mm/page_alloc.c
--- linux-2.4.24.orig/mm/page_alloc.c 2003-12-08 14:18:51.000000000 +0000
+++ linux-2.4.24/mm/page_alloc.c 2003-12-08 15:49:35.000000000 +0000
@@ -378,7 +378,8 @@
/* here we're in the low on memory slow path */
- if (current->flags & PF_MEMALLOC && !in_interrupt()) {
+ if (((current->flags & PF_MEMALLOC) && !in_interrupt()) ||
+ (current->flags & (PF_MEMALLOC | PF_MEMDIE))) {
zone = zonelist->zones;
for (;;) {
zone_t *z = *(zone++);
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.24.orig/mm/vmscan.c linux-2.4.24/mm/vmscan.c
--- linux-2.4.24.orig/mm/vmscan.c 2003-12-08 14:18:51.000000000 +0000
+++ linux-2.4.24/mm/vmscan.c 2003-12-08 15:54:49.000000000 +0000
@@ -649,6 +649,9 @@
failed_swapout = !swap_out(classzone);
} while (--tries);
+#ifdef CONFIG_OOM_KILLER
+ out_of_memory();
+#else
if (likely(current->pid != 1))
break;
if (!check_classzone_need_balance(classzone))
@@ -656,6 +659,7 @@
__set_current_state(TASK_RUNNING);
yield();
+#endif
}
return 0;
next prev parent reply other threads:[~2003-12-08 17:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-05 15:03 old oom-vm for 2.4.32 (was oom killer in 2.4.23) Peter Bergmann
2003-12-05 19:02 ` Marcelo Tosatti
2003-12-05 23:08 ` Peter Bergmann
2003-12-08 17:15 ` Marcelo Tosatti [this message]
2003-12-08 22:00 ` Configurable OOM killer " Peter Bergmann
2003-12-15 22:28 ` Ernie Petrides
2003-12-16 0:48 ` Marcelo Tosatti
[not found] <Zxp0-1lf-9@gated-at.bofh.it>
[not found] ` <10xwC-2O0-7@gated-at.bofh.it>
2003-12-09 18:34 ` Kristian Peters
2003-12-16 13:08 ` Marcelo Tosatti
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=Pine.LNX.4.44.0312081512510.1289-100000@logos.cnet \
--to=marcelo.tosatti@cyclades.com \
--cc=andrea@suse.de \
--cc=bergmann.peter@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nfedera@esesix.at \
--cc=riel@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).