linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* old oom-vm for 2.4.32 (was oom killer in 2.4.23)
@ 2003-12-05 15:03 Peter Bergmann
  2003-12-05 19:02 ` Marcelo Tosatti
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Bergmann @ 2003-12-05 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: nfedera

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 ...

http://www.esesix.at/kernel/vm-2.4.22.diff
http://www.esesix.at/kernel/vm-2.4.22.diff.gz

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo Tosatti @ 2003-12-05 19:02 UTC (permalink / raw)
  To: Peter Bergmann; +Cc: linux-kernel, nfedera



On Fri, 5 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?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-05 19:02 ` Marcelo Tosatti
@ 2003-12-05 23:08   ` Peter Bergmann
  2003-12-08 17:15     ` Configurable OOM killer " Marcelo Tosatti
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Bergmann @ 2003-12-05 23:08 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel, nfedera

> > 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.

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-05 23:08   ` Peter Bergmann
@ 2003-12-08 17:15     ` Marcelo Tosatti
  2003-12-08 22:00       ` Peter Bergmann
  2003-12-15 22:28       ` Ernie Petrides
  0 siblings, 2 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2003-12-08 17:15 UTC (permalink / raw)
  To: Peter Bergmann; +Cc: Marcelo Tosatti, linux-kernel, nfedera, andrea, riel



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;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-08 17:15     ` Configurable OOM killer " Marcelo Tosatti
@ 2003-12-08 22:00       ` Peter Bergmann
  2003-12-15 22:28       ` Ernie Petrides
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Bergmann @ 2003-12-08 22:00 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel, kristian.peters, nfedera, andrea, riel


> 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.

Great. seems to work very well. Thx.
Ran some very hungry testprogs (memeat.c), filled a tmpfs with crap, ... 
I was satisfied with oom's kill decisions.
And it is/was very easy to modify/extend oom_kill.c  for special needs.

Maybe the Configure.help text should be somewhat more frightening.
I think aa had good reasons for disabling oom (possibility of lock up) but
among others 
I'd prefer to see your patch - a config option (default disabled +
experimental)  - in 2.4.24.

Cheers,
Pet

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-08 17:15     ` Configurable OOM killer " Marcelo Tosatti
  2003-12-08 22:00       ` Peter Bergmann
@ 2003-12-15 22:28       ` Ernie Petrides
  2003-12-16  0:48         ` Marcelo Tosatti
  1 sibling, 1 reply; 9+ messages in thread
From: Ernie Petrides @ 2003-12-15 22:28 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Peter Bergmann, nfedera, andrea, riel, linux-kernel

On Monday, 8-Dec-2003 at 15:15 -0200, Marcelo Tosatti wrote:

> 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.
[...]
> --- 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++);
[...]


Hi, Marcelo.  I haven't studied this patch, but the change above looks
suspicious.  The part added after the || makes the original condition
irrelevant (because the 2nd part is true if either the PF_MEMALLOC or
PF_MEMDIE flags are set).

Were you perhaps thinking of something like this?

	if ((current->flags & PF_MEMALLOC) &&
	    ((current->flags & PF_MEMDIE) || !in_interrupt())) {

Cheers.  -ernie

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-15 22:28       ` Ernie Petrides
@ 2003-12-16  0:48         ` Marcelo Tosatti
  0 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2003-12-16  0:48 UTC (permalink / raw)
  To: Ernie Petrides
  Cc: yMarcelo Tosatti, Peter Bergmann, nfedera, andrea, riel, linux-kernel



On Mon, 15 Dec 2003, Ernie Petrides wrote:

> On Monday, 8-Dec-2003 at 15:15 -0200, Marcelo Tosatti wrote:
> 
> > 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.
> [...]
> > --- 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++);
> [...]
> 
> 
> Hi, Marcelo.  I haven't studied this patch, but the change above looks
> suspicious.  The part added after the || makes the original condition
> irrelevant (because the 2nd part is true if either the PF_MEMALLOC or
> PF_MEMDIE flags are set).
>
> 
> Were you perhaps thinking of something like this?
>
> 	if ((current->flags & PF_MEMALLOC) &&
> 	    ((current->flags & PF_MEMDIE) || !in_interrupt())) {
> 
> Cheers.  -ernie

Correct.  

I'll change it. Thanks


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer in 2.4.23)
  2003-12-09 18:34   ` Kristian Peters
@ 2003-12-16 13:08     ` Marcelo Tosatti
  0 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2003-12-16 13:08 UTC (permalink / raw)
  To: Kristian Peters
  Cc: Marcelo Tosatti, Peter Bergmann, linux-kernel, nfedera, andrea, riel



On Tue, 9 Dec 2003, Kristian Peters wrote:

> Marcelo Tosatti <marcelo.tosatti@cyclades.com> schrieb:
> > 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.
> 
> What about the PF_MEMDIE issues Andrea has argued ? Are they solved by the added code in page_alloc.c ?
> 
> As Andrea has pointed out earlier, a yield() after out_of_memory() is safe and should be added too.

out_of_memory() calls yield() so its not necessary. 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configurable OOM killer Re: old oom-vm for 2.4.32 (was oom killer  in 2.4.23)
       [not found] ` <10xwC-2O0-7@gated-at.bofh.it>
@ 2003-12-09 18:34   ` Kristian Peters
  2003-12-16 13:08     ` Marcelo Tosatti
  0 siblings, 1 reply; 9+ messages in thread
From: Kristian Peters @ 2003-12-09 18:34 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Peter Bergmann, linux-kernel, nfedera, andrea, riel

Marcelo Tosatti <marcelo.tosatti@cyclades.com> schrieb:
> 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.

What about the PF_MEMDIE issues Andrea has argued ? Are they solved by the added code in page_alloc.c ?

As Andrea has pointed out earlier, a yield() after out_of_memory() is safe and should be added too.

I'd really like to see that config-option in 2.4.24.

*Kristian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-12-16 13:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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     ` Configurable OOM killer " Marcelo Tosatti
2003-12-08 22:00       ` 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

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).