linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Rik van Riel <riel@conectiva.com.br>
Cc: Andrea Arcangeli <andrea@suse.de>, Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@transmeta.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] VM fix for 2.4.0-test9 & OOM handler
Date: Tue, 10 Oct 2000 01:35:58 +0200	[thread overview]
Message-ID: <20001010013558.A784@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <Pine.LNX.4.21.0010091606420.1562-100000@duckman.distro.conectiva>; from riel@conectiva.com.br on Mon, Oct 09, 2000 at 04:07:32PM -0300

On Mon, Oct 09, 2000 at 04:07:32PM -0300, Rik van Riel wrote:
> > If the oom killer kills a thing like init by mistake
> That only happens in the "random" OOM killer 2.2 has ...

[OOM killer war]

Hi there,

before you argue endlessly about the "Right OOM Killer (TM)", I
did a small patch to allow replacing the OOM killer at runtime.

You can even use modules, if you are careful (see khttpd on how
to do this without refcouting).

So now you can stop arguing about the one and only OOM killer,
implement it, provide it as module and get back to the important
stuff ;-)

PS: Patch is against test9 with Rik's latest vmpatch applied.

Thanks for listening

Ingo Oeser

diff -Naur linux-2.4.0-test9-vmpatch/include/linux/swap.h linux-2.4.0-test9-vmpatch-ioe/include/linux/swap.h
--- linux-2.4.0-test9-vmpatch/include/linux/swap.h	Sun Oct  8 00:49:17 2000
+++ linux-2.4.0-test9-vmpatch-ioe/include/linux/swap.h	Tue Oct 10 00:50:17 2000
@@ -129,6 +129,9 @@
 /* linux/mm/oom_kill.c */
 extern int out_of_memory(void);
 extern void oom_kill(void);
+void install_oom_killer(void (*new_oom_kill)(void));
+void reset_default_oom_killer(void);
+
 
 /*
  * Make these inline later once they are working properly.
diff -Naur linux-2.4.0-test9-vmpatch/mm/Makefile linux-2.4.0-test9-vmpatch-ioe/mm/Makefile
--- linux-2.4.0-test9-vmpatch/mm/Makefile	Sun Oct  8 00:49:17 2000
+++ linux-2.4.0-test9-vmpatch-ioe/mm/Makefile	Tue Oct 10 00:10:07 2000
@@ -10,7 +10,8 @@
 O_TARGET := mm.o
 O_OBJS	 := memory.o mmap.o filemap.o mprotect.o mlock.o mremap.o \
 	    vmalloc.o slab.o bootmem.o swap.o vmscan.o page_io.o \
-	    page_alloc.o swap_state.o swapfile.o numa.o oom_kill.o
+	    page_alloc.o swap_state.o swapfile.o numa.o
+OX_OBJS  := oom_kill.o
 
 ifeq ($(CONFIG_HIGHMEM),y)
 O_OBJS += highmem.o
diff -Naur linux-2.4.0-test9-vmpatch/mm/oom_kill.c linux-2.4.0-test9-vmpatch-ioe/mm/oom_kill.c
--- linux-2.4.0-test9-vmpatch/mm/oom_kill.c	Sun Oct  8 00:49:17 2000
+++ linux-2.4.0-test9-vmpatch-ioe/mm/oom_kill.c	Tue Oct 10 00:35:32 2000
@@ -13,6 +13,8 @@
  *  machine) this file will double as a 'coding guide' and a signpost
  *  for newbie kernel hackers. It features several pointers to major
  *  kernel subsystems and hints as to where to find out what things do.
+ *
+ *  Added oom_killer API for special needs - Ingo Oeser
  */
 
 #include <linux/mm.h>
@@ -147,7 +149,9 @@
  * CAP_SYS_RAW_IO set, send SIGTERM instead (but it's unlikely that
  * we select a process with CAP_SYS_RAW_IO set).
  */
-void oom_kill(void)
+
+
+static void oom_kill_rik(void)
 {
 
 	struct task_struct *p = select_bad_process();
@@ -207,4 +211,26 @@
 
 	/* Else... */
 	return 1;
+}
+
+/* Protects oom_killer against resetting during its execution */
+static rwlock_t oom_kill_lock;
+
+static void (*oom_killer)(void)=oom_kill_rik;
+
+void oom_kill(void) {
+	read_lock(&oom_kill_lock);
+	oom_killer();
+	read_unlock(&oom_kill_lock);
+}
+
+void install_oom_killer(void (*new_oom_kill)(void)) {
+	if (!new_oom_kill) return;
+	write_lock(&oom_kill_lock);
+	oom_killer=new_oom_kill;
+	write_unlock(&oom_kill_lock);
+}
+
+void reset_default_oom_killer(void) {
+	install_oom_killer(&oom_kill_rik);
 }

-- 
Feel the power of the penguin - run linux@your.pc
<esc>:x
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  parent reply	other threads:[~2000-10-09 23:35 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-06 18:59 Rik van Riel
2000-10-06 20:19 ` Byron Stanoszek
2000-10-06 20:31   ` Rik van Riel
2000-10-09 10:12     ` Marco Colombo
2000-10-09 11:27       ` Byron Stanoszek
2000-10-09 16:26       ` Kurt Garloff
2000-10-09 18:29         ` Jamie Lokier
2000-10-09 17:27       ` Ingo Molnar
2000-10-09 17:25         ` Mark Hahn
2000-10-09 17:37           ` Ingo Molnar
2000-10-09 17:47           ` Ed Tomlinson
2000-10-09 18:01             ` Ingo Molnar
2000-10-09 18:14       ` Rik van Riel
2000-10-09 18:47         ` Ingo Molnar
2000-10-09 18:52           ` Rik van Riel
2000-10-09 19:27             ` Ingo Molnar
2000-10-09 19:38         ` Marco Colombo
2000-10-06 21:27   ` David Weinehall
2000-10-06 23:21     ` David Weinehall
2000-10-09 18:28   ` Andrea Arcangeli
2000-10-09 18:42     ` Ingo Molnar
2000-10-09 19:05       ` Andrea Arcangeli
2000-10-09 19:07         ` Rik van Riel
2000-10-09 19:42           ` Andrea Arcangeli
2000-10-09 20:06             ` Ingo Molnar
2000-10-09 20:06               ` Andi Kleen
2000-10-09 20:19                 ` Ingo Molnar
2000-10-09 20:12                   ` Rik van Riel
2000-10-09 20:24                     ` Ingo Molnar
2000-10-09 20:18                       ` Rik van Riel
2000-10-10  3:23                         ` Philipp Rumpf
2000-10-09 20:38                       ` James Sutherland
2000-10-09 20:40                         ` Rik van Riel
2000-10-10  9:59                           ` J.A. Sutherland
2000-10-09 20:44                         ` Andrea Arcangeli
2000-10-09 21:52                         ` Aaron Sethman
2000-10-09 21:54                           ` Rik van Riel
2000-10-09 22:29                       ` FORT David
2000-10-09 20:52                 ` Linus Torvalds
2000-10-09 20:58                   ` Andi Kleen
2000-10-09 21:21                     ` Jim Gettys
2000-10-09 21:28                       ` Alan Cox
2000-10-09 21:34                         ` Andi Kleen
2000-10-09 21:38                         ` Linus Torvalds
2000-10-09 21:39                           ` Rik van Riel
2000-10-09 21:44                             ` Linus Torvalds
2000-10-10 13:17                               ` Marco Colombo
2000-10-09 21:44                           ` Jim Gettys
2000-10-09 21:50                             ` Linus Torvalds
2000-10-09 22:07                               ` Jim Gettys
2000-10-09 23:13                                 ` Albert D. Cahalan
2000-10-09 23:16                                   ` Rik van Riel
2000-10-09 23:46                                   ` Jim Gettys
2000-10-10  9:46                                   ` Jamie Lokier
2000-10-10 14:41                               ` Rogier Wolff
2000-10-10 17:28                                 ` Linus Torvalds
2000-10-09 21:51                           ` Alan Cox
2000-10-09 21:40                         ` Jim Gettys
2000-10-09 21:05                   ` Rik van Riel
2000-10-09 22:08                     ` Gerrit.Huizenga
2000-10-09 22:34                       ` Byron Stanoszek
2000-10-09 22:57                         ` Rik van Riel
2000-10-10  0:25                         ` [RFC] New ideas for the " Byron Stanoszek
2000-10-09 20:11               ` [PATCH] VM fix for 2.4.0-test9 & " Andrea Arcangeli
2000-10-09 20:15                 ` Rik van Riel
2000-10-09 20:40               ` Linus Torvalds
2000-10-09 20:47                 ` Rik van Riel
2000-10-09 20:57                 ` Ingo Molnar
2000-10-09 21:10                   ` Peter Waltenberg
2000-10-09 22:25                     ` Andrea Arcangeli
2000-10-09 22:59                       ` Peter Waltenberg
2000-10-09 23:52                         ` Andrea Arcangeli
2000-10-09 23:10                       ` Rik van Riel
2000-10-09 21:10               ` Alan Cox
2000-10-09 21:25                 ` Ingo Molnar
2000-10-09 21:26                   ` Rik van Riel
2000-10-09 21:38                     ` Ingo Molnar
2000-10-09 21:34                       ` Rik van Riel
2000-10-10  9:09                         ` john slee
2000-10-09 20:06             ` Rik van Riel
2000-10-09 20:18               ` Andrea Arcangeli
2000-10-10  3:29               ` Philipp Rumpf
2000-10-10 15:06                 ` Rik van Riel
2000-10-10 15:24                   ` Philipp Rumpf
2000-10-10 15:30                     ` Rik van Riel
2000-10-10 15:37                       ` Philipp Rumpf
2000-10-09 20:13           ` Ingo Molnar
2000-10-09 20:08             ` Rik van Riel
2000-10-09 20:22               ` Ingo Molnar
2000-10-09 20:28                 ` David Ford
2000-10-09 20:34                   ` Rik van Riel
2000-10-09 20:45                     ` David Ford
2000-10-10  4:22                       ` Andreas Dilger
2000-10-10  4:30                         ` David Ford
2000-10-10  9:54                         ` Jamie Lokier
2000-10-09 23:35           ` Ingo Oeser [this message]
2000-10-10 15:07             ` [PATCH] OOM killer API (was: [PATCH] VM fix for 2.4.0-test9 & OOM handler) Ingo Oeser
2000-10-10 15:32               ` Rik van Riel
2000-10-10 16:11                 ` Ingo Oeser
2000-10-10 18:57                 ` Tom Rini
2000-10-10 20:58                   ` Rik van Riel
2000-10-10 22:46                     ` Tom Rini
2000-10-09 19:30       ` [PATCH] VM fix for 2.4.0-test9 & OOM handler David Ford
2000-10-09 19:58         ` Andrea Arcangeli
2000-10-09 20:14           ` David Ford
2000-10-09 20:05         ` Rik van Riel
2000-10-09 21:07         ` Alan Cox
2000-10-10  3:38           ` Philipp Rumpf
2000-10-10 14:07             ` Andrea Arcangeli
2000-10-09 18:07 Wagner, Dave
2000-10-09 20:27 ` James Sutherland
2000-10-09 19:06 Hubertus Franke/Watson/IBM

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=20001010013558.A784@nightmaster.csn.tu-chemnitz.de \
    --to=ingo.oeser@informatik.tu-chemnitz.de \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=riel@conectiva.com.br \
    --cc=torvalds@transmeta.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