linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Prevent OOM from killing init
       [not found] <20010323015358Z129164-406+3041@vger.kernel.org>
@ 2001-03-23  7:04 ` Rik van Riel
  2001-03-23 11:28   ` Guest section DW
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-23  7:04 UTC (permalink / raw)
  To: Michael Peddemors
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

On 22 Mar 2001, Michael Peddemors wrote:

> Here, Here.. killing qmail on a server who's sole task is running mail
> doesn't seem to make much sense either..

I won't defend the current OOM killing code.

Instead, I'm asking everybody who's unhappy with the
current code to come up with something better.

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23  7:04 ` [PATCH] Prevent OOM from killing init Rik van Riel
@ 2001-03-23 11:28   ` Guest section DW
  2001-03-23 14:50     ` Eric W. Biederman
  0 siblings, 1 reply; 85+ messages in thread
From: Guest section DW @ 2001-03-23 11:28 UTC (permalink / raw)
  To: Rik van Riel, Michael Peddemors
  Cc: Stephen Clouse, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, Mar 23, 2001 at 04:04:09AM -0300, Rik van Riel wrote:
> On 22 Mar 2001, Michael Peddemors wrote:
> 
> > Here, Here.. killing qmail on a server who's sole task is running mail
> > doesn't seem to make much sense either..
> 
> I won't defend the current OOM killing code.
> 
> Instead, I'm asking everybody who's unhappy with the
> current code to come up with something better.

To a murderer: "Why did you kill that old lady?"
Reply: "I won't defend that deed, but who else should I have killed?"

Andries - getting more and more unhappy with OOM

Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 2019 (emacs).
Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 1407 (emacs).
Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 1495 (emacs).
Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 2800 (rpm).

[yes, that was rpm growing too large, taking a few emacs sessions]
[2.4.2]
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 11:28   ` Guest section DW
@ 2001-03-23 14:50     ` Eric W. Biederman
  2001-03-23 15:13       ` General 2.4 impressions (was Re: [PATCH] Prevent OOM from killing init) Jeff Garzik
  2001-03-23 17:21       ` [PATCH] Prevent OOM from killing init Guest section DW
  0 siblings, 2 replies; 85+ messages in thread
From: Eric W. Biederman @ 2001-03-23 14:50 UTC (permalink / raw)
  To: Guest section DW
  Cc: Rik van Riel, Michael Peddemors, Stephen Clouse,
	Patrick O'Rourke, linux-mm, linux-kernel

Guest section DW <dwguest@win.tue.nl> writes:

> On Fri, Mar 23, 2001 at 04:04:09AM -0300, Rik van Riel wrote:
> > On 22 Mar 2001, Michael Peddemors wrote:
> > 
> > > Here, Here.. killing qmail on a server who's sole task is running mail
> > > doesn't seem to make much sense either..
> > 
> > I won't defend the current OOM killing code.
> > 
> > Instead, I'm asking everybody who's unhappy with the
> > current code to come up with something better.
> 
> To a murderer: "Why did you kill that old lady?"
> Reply: "I won't defend that deed, but who else should I have killed?"

> 
> Andries - getting more and more unhappy with OOM
> 
> Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 2019 (emacs).
> Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 1407 (emacs).
> Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 1495 (emacs).
> Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 2800 (rpm).
> 
> [yes, that was rpm growing too large, taking a few emacs sessions]
> [2.4.2]

Let me get this straight you don't have enough swap for your workload?
And you don't have per process limits on root by default?

So you are complaining about the OOM killer?  

Eric
--
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/

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

* General 2.4 impressions (was Re: [PATCH] Prevent OOM from killing init)
  2001-03-23 14:50     ` Eric W. Biederman
@ 2001-03-23 15:13       ` Jeff Garzik
  2001-03-23 16:10         ` Adding just a pinch of icache/dcache pressure Jan Harkes
  2001-03-23 17:21       ` [PATCH] Prevent OOM from killing init Guest section DW
  1 sibling, 1 reply; 85+ messages in thread
From: Jeff Garzik @ 2001-03-23 15:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm

Personally I think the OOM killer itself is fine.  I think there are
problems elsewhere which are triggering the OOM killer when it should
not be triggered, ie. a leak like Doug Ledford was reporting.

I definitely see heavier page/dcache usage in 2.4 -- but that is to be
expected due to 2.4 changes!  So it is incredibily difficult to quantify
if something is wrong, and if so, where...

My own impressions of 2.4 are that it "feels faster" for my own uses and
it's stable.  The downsides I find are that heavy fs activity seems to
imply increased swapping, which jibes with a guess that the page/dcache
is exceptionally greedy with releasing pages under memory pressure.

</unquantified vague ramble>

-- 
Jeff Garzik       | May you have warm words on a cold evening,
Building 1024     | a full moon on a dark night,
MandrakeSoft      | and a smooth road all the way to your door.
--
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/

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

* Adding just a pinch of icache/dcache pressure...
  2001-03-23 15:13       ` General 2.4 impressions (was Re: [PATCH] Prevent OOM from killing init) Jeff Garzik
@ 2001-03-23 16:10         ` Jan Harkes
  2001-03-23 16:17           ` Andi Kleen
  0 siblings, 1 reply; 85+ messages in thread
From: Jan Harkes @ 2001-03-23 16:10 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, linux-mm

On Fri, Mar 23, 2001 at 10:13:55AM -0500, Jeff Garzik wrote:
> Personally I think the OOM killer itself is fine.  I think there are
> problems elsewhere which are triggering the OOM killer when it should
> not be triggered, ie. a leak like Doug Ledford was reporting.
> 
> I definitely see heavier page/dcache usage in 2.4 -- but that is to be
> expected due to 2.4 changes!  So it is incredibily difficult to quantify
> if something is wrong, and if so, where...
> 
> My own impressions of 2.4 are that it "feels faster" for my own uses and
> it's stable.  The downsides I find are that heavy fs activity seems to
> imply increased swapping, which jibes with a guess that the page/dcache
> is exceptionally greedy with releasing pages under memory pressure.
> 
> </unquantified vague ramble>

Like I said earlier, I should stop theorizing and write the code. Here
is a teeny little patch that adds a bit of pressure to the inode and
dentry slabcaches during inactive shortage.

On the 512MB desktop without the change, the inode+dentry slabs
typically used up about 300MB after running my normal day-to-day
workload for about 24 hours. Now, the inode+dentry slabs are using
only 90MB.

As there is more memory available for the buffer and page caches, kswapd
seems to have less trouble keeping up with my typical workload.


btw. There definitely is a network receive buffer leak somewhere in
either the 3c905C path or higher up in the network layers (2.4.0 or
2.4.1). The normal path does not leak anything.

I was seeing it only for a couple of days when there was a failing
switch that must have randomly corrupted packets. The switch got
replaced and the leakage disappeared, so I went back into a non-ikd
kernel and stopped looking for the problem.

Jan


=================
--- linux/fs/inode.c.orig	Thu Mar 22 13:20:55 2001
+++ linux/fs/inode.c	Thu Mar 22 14:00:10 2001
@@ -270,19 +270,6 @@
 	spin_unlock(&inode_lock);
 }
 
-/*
- * Called with the spinlock already held..
- */
-static void sync_all_inodes(void)
-{
-	struct super_block * sb = sb_entry(super_blocks.next);
-	for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.next)) {
-		if (!sb->s_dev)
-			continue;
-		sync_list(&sb->s_dirty);
-	}
-}
-
 /**
  *	write_inode_now	-	write an inode to disk
  *	@inode: inode to write to disk
@@ -507,8 +494,6 @@
 	struct inode * inode;
 
 	spin_lock(&inode_lock);
-	/* go simple and safe syncing everything before starting */
-	sync_all_inodes();
 
 	entry = inode_unused.prev;
 	while (entry != &inode_unused)
@@ -554,6 +539,9 @@
 
 	if (priority)
 		count = inodes_stat.nr_unused / priority;
+
+	if (priority < 6)
+		sync_inodes(0);
 
 	prune_icache(count);
 	kmem_cache_shrink(inode_cachep);
--- linux/mm/vmscan.c.orig	Thu Mar 22 14:00:41 2001
+++ linux/mm/vmscan.c	Thu Mar 22 14:35:26 2001
@@ -845,9 +845,11 @@
 	 * reclaim unused slab cache if memory is low.
 	 */
 	if (free_shortage()) {
+		shrink_dcache_memory(5, gfp_mask);
+		shrink_icache_memory(5, gfp_mask);
+	} else {
 		shrink_dcache_memory(DEF_PRIORITY, gfp_mask);
 		shrink_icache_memory(DEF_PRIORITY, gfp_mask);
-	} else {
 		/*
 		 * Illogical, but true. At least for now.
 		 *
--
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/

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

* Re: Adding just a pinch of icache/dcache pressure...
  2001-03-23 16:10         ` Adding just a pinch of icache/dcache pressure Jan Harkes
@ 2001-03-23 16:17           ` Andi Kleen
  0 siblings, 0 replies; 85+ messages in thread
From: Andi Kleen @ 2001-03-23 16:17 UTC (permalink / raw)
  To: Jan Harkes; +Cc: Jeff Garzik, linux-kernel, linux-mm

On Fri, Mar 23, 2001 at 05:10:56PM +0100, Jan Harkes wrote:
> btw. There definitely is a network receive buffer leak somewhere in
> either the 3c905C path or higher up in the network layers (2.4.0 or
> 2.4.1). The normal path does not leak anything.


What do you mean with "normal path" ? 

And are you sure it was a leak? TCP can buffer quite a bit of skbs, but it 
should be bounded based on the number of sockets. 


-Andi

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 14:50     ` Eric W. Biederman
  2001-03-23 15:13       ` General 2.4 impressions (was Re: [PATCH] Prevent OOM from killing init) Jeff Garzik
@ 2001-03-23 17:21       ` Guest section DW
  2001-03-23 20:18         ` Paul Jakma
  2001-03-23 23:48         ` Eric W. Biederman
  1 sibling, 2 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-23 17:21 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Rik van Riel, Michael Peddemors, Stephen Clouse,
	Patrick O'Rourke, linux-mm, linux-kernel

On Fri, Mar 23, 2001 at 07:50:25AM -0700, Eric W. Biederman wrote:

> > Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 2019 (emacs).
> > Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 1407 (emacs).
> > Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 1495 (emacs).
> > Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 2800 (rpm).
> > 
> > [yes, that was rpm growing too large, taking a few emacs sessions]
> > [2.4.2]
> 
> Let me get this straight you don't have enough swap for your workload?
> And you don't have per process limits on root by default?
> 
> So you are complaining about the OOM killer?  

I should not react - your questions are phrased rhetorically.

But yes, I am complaining because Linux by default is unreliable.
I strongly prefer a system that is reliable by default,
and I'll leave it to others to run it in an unreliable mode.

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:21       ` [PATCH] Prevent OOM from killing init Guest section DW
@ 2001-03-23 20:18         ` Paul Jakma
  2001-03-24 20:19           ` Jesse Pollard
  2001-03-23 23:48         ` Eric W. Biederman
  1 sibling, 1 reply; 85+ messages in thread
From: Paul Jakma @ 2001-03-23 20:18 UTC (permalink / raw)
  To: Guest section DW
  Cc: Eric W. Biederman, Rik van Riel, Michael Peddemors,
	Stephen Clouse, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Guest section DW wrote:

> But yes, I am complaining because Linux by default is unreliable.

no, your distribution is unreliable by default.

> I strongly prefer a system that is reliable by default,
> and I'll leave it to others to run it in an unreliable mode.

currently, setting sensible user limits on my machines means i never
get a hosed machine due to OOM. These limits are easy to set via
pam_limits. (not perfect though, i think its session specific..)

granted, if the machine hasn't been setup with user limits, then linux
doesn't deal at all well with OOM, so this should be fixed. but it can
easily be argued that admin error in not configuring limits is the
main cause for OOM.

> Andries

regards,

--paulj

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:21       ` [PATCH] Prevent OOM from killing init Guest section DW
  2001-03-23 20:18         ` Paul Jakma
@ 2001-03-23 23:48         ` Eric W. Biederman
  1 sibling, 0 replies; 85+ messages in thread
From: Eric W. Biederman @ 2001-03-23 23:48 UTC (permalink / raw)
  To: Guest section DW
  Cc: Rik van Riel, Michael Peddemors, Stephen Clouse,
	Patrick O'Rourke, linux-mm, linux-kernel

Guest section DW <dwguest@win.tue.nl> writes:

> On Fri, Mar 23, 2001 at 07:50:25AM -0700, Eric W. Biederman wrote:
> 
> > > Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 2019 (emacs).
> > > Mar 23 11:48:49 mette kernel: Out of Memory: Killed process 1407 (emacs).
> > > Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 1495 (emacs).
> > > Mar 23 11:48:50 mette kernel: Out of Memory: Killed process 2800 (rpm).
> > > 
> > > [yes, that was rpm growing too large, taking a few emacs sessions]
> > > [2.4.2]
> > 
> > Let me get this straight you don't have enough swap for your workload?
> > And you don't have per process limits on root by default?
> > 
> > So you are complaining about the OOM killer?  
> 
> I should not react - your questions are phrased rhetorically.

To some extent I was also very puzzled by your complaint.

You have setup a system that by your definition unreliably and then
you complain it is unreliable.

> 
> But yes, I am complaining because Linux by default is unreliable.
> I strongly prefer a system that is reliable by default,
> and I'll leave it to others to run it in an unreliable mode.

Now all I know the system didn't have enough resources to do what
you asked to it do and it failed.  That sounds reliable to me.  

Obviously you were suprised at how the system failed.  Given
that unix has been doing this kind of thing for decades, you obviously
missed how the unix malloc overcommited memory.

Does you application trap sigsegv on a different stack so you can
catch stack growth failure?  And how does your app handle this case?

Having a no over commit kernel option would help.  

A cheap workaround is to call mlock_all(MCL_FUTRE...).  Then you are
garantteed you will always have ram locked into memory for your
program.   This assumes you have enough ram for your program.

Eric

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 20:18         ` Paul Jakma
@ 2001-03-24 20:19           ` Jesse Pollard
  0 siblings, 0 replies; 85+ messages in thread
From: Jesse Pollard @ 2001-03-24 20:19 UTC (permalink / raw)
  To: Paul Jakma, Guest section DW
  Cc: Eric W. Biederman, Rik van Riel, Michael Peddemors,
	Stephen Clouse, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Paul Jakma wrote:
>On Fri, 23 Mar 2001, Guest section DW wrote:
>
>> But yes, I am complaining because Linux by default is unreliable.
>
>no, your distribution is unreliable by default.
>
>> I strongly prefer a system that is reliable by default,
>> and I'll leave it to others to run it in an unreliable mode.
>
>currently, setting sensible user limits on my machines means i never
>get a hosed machine due to OOM. These limits are easy to set via
>pam_limits. (not perfect though, i think its session specific..)

Process specific. Each forked process gets the same limits. You get OOM
as soon as all processes together use more than the system capacity.

>granted, if the machine hasn't been setup with user limits, then linux
>doesn't deal at all well with OOM, so this should be fixed. but it can
>easily be argued that admin error in not configuring limits is the
>main cause for OOM.

Admin has no real control is the problem. Limits are only good for one
process. As soon as that process forks one other process then the
useage limit is twice the limit established.

>> Andries
>
>regards,
>
>--paulj

-- 
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: jesse@cats-chateau.net

Any opinions expressed are solely my own.
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23  0:20         ` Stephen Clouse
@ 2002-03-23  1:30           ` Martin Dalecki
  2001-03-23  1:37             ` Rik van Riel
  0 siblings, 1 reply; 85+ messages in thread
From: Martin Dalecki @ 2002-03-23  1:30 UTC (permalink / raw)
  To: Stephen Clouse
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

Stephen Clouse wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Sat, Mar 23, 2002 at 01:33:50AM +0100, Martin Dalecki wrote:
> > AMEN! TO THIS!
> > Uptime of a process is a much better mesaure for a killing candidate
> > then it's size.
> 
> Thing is, if you take a good study of mm/oom_kill.c, it *does* take start time

I did thing is Rik did use a non normalized formula in oom_kill for the
calculation of the kill penalty a process get's. This is the main
reason for the non controllable behaviour of it.

> into account, as well as CPU time.  The problem is that a process (like Oracle,
> in our case) using ludicrous amounts of memory can still rank at the top of the
> list, even with the time-based reduction factors, because total VM is the
> starting number in the equation for determining what to kill.  Oracle or what
> not sitting at 80 MB for a day or two will still find a way to outrank the
> newly-started 1 MB shell process whose malloc triggered oom_kill in the first
> place.

This is due to the broken calculation formula in oom_kill().

> 
> If anything, time really needs to be a hard criterion for sorting the final list
> on and not merely a variable in the equation and thus tied to vmsize.
> 
> This is why the production database boxen aren't running 2.4 yet.  I can control
> Oracle's usage very finely (since it uses a fixed memory pool preallocated at
> startup), but if something else decides to fire up on there (like the nightly
> backup and maintenance routine) and decides it needs just a pinch more memory
> than what's available -- ick.  2.2.x doesn't appear to enforce new memory
> allocation with a sniper rifle -- the new process just suffers a pleasant ("Out
> of memory!") or violent (SIGSEGV) death.

And you should never ever overcommit memmory to oracle! Don't make the
buffers bigger then half the memmory in the system really. There ARE
circumstances where oracle is using all available memmory in very random
manner.
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:53         ` Rik van Riel
@ 2002-03-23  1:21           ` Martin Dalecki
  0 siblings, 0 replies; 85+ messages in thread
From: Martin Dalecki @ 2002-03-23  1:21 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

Rik van Riel wrote:
> 
> On Sat, 23 Mar 2002, Martin Dalecki wrote:
> 
> > Uptime of a process is a much better mesaure for a killing
> > candidate then it's size.
> 
> You'll have fun with your root shell, then  ;)

You mean the remote one? 

> The current OOM code takes things like uptime, used cpu, size
> and a bunch of other things into account.
> 
> If it turns out that the code is not attaching a proper weight
> to some of these factors, you should be sending patches, not
> flames.

Did I say anything insulting? I have just stated what I think
is more important... BTW> it's not quite obvious that
You have to look into oom_kill to find it in the kernel
source where to look at. (Yes I did just find /usr/src/linux -name
"oom*"
becouse I happen to remember but!

OK i will just place - in front of the description lines where I think
that you where mislead:



 * Good in this context means that:
 * 1) we lose the minimum amount of work done
-* 2) we recover a large amount of memory
 * 3) we don't kill anything innocent of eating tons of memory
-* 4) we want to kill the minimum amount of processes (one)
 * 5) we try to kill the process the user expects us to kill, this
 *    algorithm has been meticulously tuned to meet the priniciple
 *    of least surprise ... (be careful when you change it)

The following is a wrong assumtion. You usually nice processes to
the background just to guarantee for example smoot interaction just
in case you won't login in in some time to the machine.

For example let's have an dedicated http server, which does a lot of
embedded perl.
It's quite clever to renice it back, just in case this
remote machine get's overloaded, becouse otherwise your chances
to get a login in case the machine starts to trash,
would be much worser. But this doesn't mean that the
process isn't more important - becouse you do it to make the
machine crowl through high load peaks and still let you in in
case you have something urgent to do on it.

        /*
         * Niced processes are most likely less important, so double
         * their badness points.
         */
        if (p->nice > 0)
                points *= 2;

BTW> Why the hell you don't just use a polynomial approximation for
int_sqrt - the range of values is very closed an you are
working in a finite ring anyway - you could very easly find
a simple approximation which wouldn't need any looping.

This should be reversted:

        points /= int_sqrt(cpu_time);
        points /= int_sqrt(int_sqrt(run_time));
    points = p->mm->total_vm;

        /*
         * CPU time is in seconds and run time is in minutes. There is
no
         * particular reason for this other than that it turned out to
work
         * very well in practice. This is not safe against jiffie wraps
         * but we don't care _that_ much...
         */
        cpu_time = (p->times.tms_utime + p->times.tms_stime) >>
(SHIFT_HZ + 3);
        run_time = (jiffies - p->start_time) >> (SHIFT_HZ + 10);

        points /= int_sqrt(cpu_time);
        points /= int_sqrt(int_sqrt(run_time));


==============================================================

NOW I SEE THE MOST IMPORTANT MISTAKE:

There should be a de-normalization of the units

CPU_time/total_uptime
RUN_time/total_uptime
mem/total_mem.

Otherwise you can't map the intended logics sufficiently safe
on to the calculation you do. You compare bits with seconds - which is
WRONG.

Let:
 m := memmory used by the process 
 M := the total memmory in the system.
 c := cpu time used by the process
 u := uptime of the process.
 U := uptime of the system

Then you calculate points
as 

(m / sqrt(c)) / sqrt(sqrt(r))

Which is just very wired function with a non homogen behaviour.
(Just take the first derivative of it in any dimension to see what I
mean)


You should calculate to represent you intended logics:

 x * (m / M) + y * (U / c) + z * (U / u),

where x y z are constants representing the wighting heuristic
importance one gives to those particular measure points.

A simple *normalized* polynom the only thing people and computers can
realy deal with.

> (the code is full of comments, so it should be easy enough to
> find your way around the code and tweak it until it does the
> right thing in a number of test cases)
> 
> regards,
> 
> Rik
> --
> Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml
> 
> Virtual memory is like a game you can't win;
> However, without VM there's truly nothing to lose...
> 
>                 http://www.surriel.com/
> http://www.conectiva.com/       http://distro.conectiva.com/

-- 
- phone: +49 214 8656 283
- job:   eVision-Ventures AG, LEV .de (MY OPINIONS ARE MY OWN!)
- langs: de_DE.ISO8859-1, en_US, pl_PL.ISO8859-2, last ressort:
ru_RU.KOI8-R
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 20:28     ` Stephen Clouse
                         ` (2 preceding siblings ...)
  2001-03-23  1:31       ` Michael Peddemors
@ 2002-03-23  0:33       ` Martin Dalecki
  2001-03-22 23:53         ` Rik van Riel
  2001-03-23  0:20         ` Stephen Clouse
  3 siblings, 2 replies; 85+ messages in thread
From: Martin Dalecki @ 2002-03-23  0:33 UTC (permalink / raw)
  To: Stephen Clouse
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

Stephen Clouse wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Thu, Mar 22, 2001 at 12:47:27PM +0100, Guest section DW wrote:
> > Last week I installed SuSE 7.1 somewhere.
> > During the install: "VM: killing process rpm",
> > leaving the installer rather confused.
> > (An empty machine, 256MB, 144MB swap, I think 2.2.18.)
> >
> > Last month I had a computer algebra process running for a week.
> > Killed. But this computation was the only task this machine had.
> > Its sole reason of existence.
> > Too bad - zero information out of a week's computation.
> > (I think 2.4.0.)
> >
> > Clearly, Linux cannot be reliable if any process can be killed
> > at any moment. I am not happy at all with my recent experiences.
> 
> Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
> logically justify annihilating large-VM processes that have been running for
> days or weeks instead of just returning ENOMEM to a process that just started
> up.
> 
> We run Oracle on a development box here, and it's always the first to get the
> axe (non-root process using 70-80 MB VM).  Whenever someone's testing decides to
> run away with memory, I usually spend the rest of the day getting intimate with
> the backup files, since SIGKILLing random Oracle processes, as you might have
> guessed, has a tendency to rape the entire database.
> 
> It would be nice to give immunity to certain uids, or better yet, just turn the
> damn thing off entirely.  I've already hacked that in...errr, out.

AMEN! TO THIS!
Uptime of a process is a much better mesaure for a killing candidate
then it's size.
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-30  3:18                     ` Scott F. Kaplan
@ 2001-03-30 23:03                       ` Rik van Riel
  0 siblings, 0 replies; 85+ messages in thread
From: Rik van Riel @ 2001-03-30 23:03 UTC (permalink / raw)
  To: Scott F. Kaplan; +Cc: linux-mm

On Thu, 29 Mar 2001, Scott F. Kaplan wrote:
> On Tue, 27 Mar 2001, Rik van Riel wrote:
> 
> > I plan to "detect" thrashing by keeping a kind of "swap load
> > average", that is, measuring in the same way as the load average how
> > many tasks are waiting on page faults simultaneously.
> 
> This seems a practical metric.  It is a bit indirect, as it's not
> measuring the reference behavior of the processes.  For example, a
> couple of processes may change phases, and make it seem, via heavy
> faulting for a time, that memory is overcommitted.  However, that
> faulting doesn't necessarily represent the inability of main memory to
> cache the critical working sets of each active process.  It's not
> "thrashing" in the sense that the CPU is doomed not to have ready
> processes to run.

If 3 processes get the CPU and 2 processes never get a 
chance to run (and are thrashing), that too is an issue
I'd like to get solved.

> > When this swap load average will get too high (too high in
> > relation to the "normal" load average ???) and possibly a few
> > other conditions are true we will select a process to suspend.
> 
> I think these may be some of the biggest questions.  Detecting that
> there is serious strain on main memory can be done.  Detecting whether
> or not it's worth trying to deactivate a process is another
> matter...It's an expensive proposition, and fundamentally changes the
> fairness with which the victim process is treated.

It's like a 2nd level scheduler, where processes become 'victim'
process in turns. But indeed, I realise that this doesn't solve
the selection problem ;)

> > This process will not be suspended immediately, but only on the next
> > page fault. It's pages will be stolen by kswapd in the normal way.
> 
> That makes sense...but which process?  There are old heuristics
> (youngest process, oldest, largest resident set, smallest, random,
> etc.).  Some of them have been shown to work better than others, but
> they're all "blind", in that there's no attempt to determine whether
> or not the other processes, left active, will really receive the extra
> space that they need once a process is selected.  That would seem to
> be a useful piece of information.
> 
> An example -- one, nasty, greedy process that uses so much space that
> it could force the deactivation of nearly all of the other processes.
> If you do that, it's unfair to too many processes.  If you deactivate
> the hog, then every time you bring it back, it will cause heavy
> paging, and a deactivation.  Ugh.

But it should cause deactivation of OTHER processes so every
process gets a chance to run...

> > We will not start reactivating processes until the swap load is
> > below the threshold again (which is automatically a reasonable
> > indication because it's a long-term floating average).
> 
> It's good that this load doesn't fluctuate too quickly.  However,
> that's no guarantee that a re-activated process won't cause
> overcommitment again (depending on which process was selected),
> leading to a nasty oscilatting behavior.  What if the load doesn't
> drop below the threshold for a long time?  Starvation is no fun,
> especially if that was your process.

The "trick" here would be to have the SAME watermark for suspending
and waking up processes and making sure that both the "swap load
average" and the rate at which processes get reactivated are slowly
changing so the re/de-activations don't cause their own thrashing.

> > Definately.  You can count on me to help think about these things
> > and help testing, etc...
> 
> Delighted to hear it!  I have more questions than answers about this
> problem, and I don't think it's been given sufficient attention
> anywhere.  Correct me if I'm wrong (please!), but I think few modern
> systems even *try* to detect overcommitment, let alone do something
> about it.  It certainly seems that for some uses, a system should have
> the option of saving the rest of the workload by unfairly sacrificing
> some process.  (And for other uses, such actions would be less
> acceptable.)

When memory is severely overcommitted, things will get slow.
What I want to make sure of is that things won't be slowing
down for one user every time while the other user always gets
to use his processes normally.

One thing I would like to do is penalise process space. One
metric we could use for this is to keep a process suspended
longer when it is bigger. For example, if we do 5 MB of swap
IO per second we could leave a 20 MB process suspended for
a minimum of 20/5 * SWAP_PENALTY = 4 * SWAP_PENALTY seconds,
while an "innocent" editor or mail reader will be suspended
for less time.

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-28  0:00                   ` Rik van Riel
@ 2001-03-30  3:18                     ` Scott F. Kaplan
  2001-03-30 23:03                       ` Rik van Riel
  0 siblings, 1 reply; 85+ messages in thread
From: Scott F. Kaplan @ 2001-03-30  3:18 UTC (permalink / raw)
  To: linux-mm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 27 Mar 2001, Rik van Riel wrote:

> I plan to "detect" thrashing by keeping a kind of "swap load
> average", that is, measuring in the same way as the load average how
> many tasks are waiting on page faults simultaneously.

This seems a practical metric.  It is a bit indirect, as it's not
measuring the reference behavior of the processes.  For example, a
couple of processes may change phases, and make it seem, via heavy
faulting for a time, that memory is overcommitted.  However, that
faulting doesn't necessarily represent the inability of main memory to
cache the critical working sets of each active process.  It's not
"thrashing" in the sense that the CPU is doomed not to have ready
processes to run.

Important note:  I'm looking for a good model, and not necessarily a
practical solution that you'd want to put in a kernel.  I know that
there can be a difference!

> When this swap load average will get too high (too high in
> relation to the "normal" load average ???) and possibly a few
> other conditions are true we will select a process to suspend.

I think these may be some of the biggest questions.  Detecting that
there is serious strain on main memory can be done.  Detecting whether
or not it's worth trying to deactivate a process is another
matter...It's an expensive proposition, and fundamentally changes the
fairness with which the victim process is treated.

> This process will not be suspended immediately, but only on the next
> page fault. It's pages will be stolen by kswapd in the normal way.

That makes sense...but which process?  There are old heuristics
(youngest process, oldest, largest resident set, smallest, random,
etc.).  Some of them have been shown to work better than others, but
they're all "blind", in that there's no attempt to determine whether
or not the other processes, left active, will really receive the extra
space that they need once a process is selected.  That would seem to
be a useful piece of information.

An example -- one, nasty, greedy process that uses so much space that
it could force the deactivation of nearly all of the other processes.
If you do that, it's unfair to too many processes.  If you deactivate
the hog, then every time you bring it back, it will cause heavy
paging, and a deactivation.  Ugh.

> We will not start reactivating processes until the swap load is
> below the threshold again (which is automatically a reasonable
> indication because it's a long-term floating average).

It's good that this load doesn't fluctuate too quickly.  However,
that's no guarantee that a re-activated process won't cause
overcommitment again (depending on which process was selected),
leading to a nasty oscilatting behavior.  What if the load doesn't
drop below the threshold for a long time?  Starvation is no fun,
especially if that was your process.

> Definately.  You can count on me to help think about these things
> and help testing, etc...

Delighted to hear it!  I have more questions than answers about this
problem, and I don't think it's been given sufficient attention
anywhere.  Correct me if I'm wrong (please!), but I think few modern
systems even *try* to detect overcommitment, let alone do something
about it.  It certainly seems that for some uses, a system should have
the option of saving the rest of the workload by unfairly sacrificing
some process.  (And for other uses, such actions would be less
acceptable.)

Scott Kaplan
sfkaplan@cs.amherst.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6w/rD8eFdWQtoOmgRAuF6AJoDeVidI3oSnmrRDCB1Da2Xz0z0bgCbBc3B
urJKhaoyDtMo/tLPaH4UrDo=
=p62R
-----END PGP SIGNATURE-----


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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-27 14:05                 ` Scott F. Kaplan
@ 2001-03-28  0:00                   ` Rik van Riel
  2001-03-30  3:18                     ` Scott F. Kaplan
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-28  0:00 UTC (permalink / raw)
  To: Scott F. Kaplan; +Cc: linux-mm

On Tue, 27 Mar 2001, Scott F. Kaplan wrote:
> On Sat, 24 Mar 2001, Rik van Riel wrote:
> 
> > [...]  I need to implement load control code (so we suspend
> > processes in turn to keep the load low enough so we can avoid
> > thrashing).
> 
> I am curious as to how you plan to go about implementing this load
> control.  I ask because it's a current area of research for me.
> Detecting the point at which thrashing occurs (that is, the point at
> which process utilization starts to fall because every active process
> is waiting for page faults, and nothing is ready to run) is not
> necessarily easy.
>
> There was a whole bunch of theory about how to detect this kind of
> over-commitment with Working Set.  Unfortunately, I'm reasonably
> convinced that there are some serious holes in that theory, and that
> nobody has developed a well founded answer to this question.  Do you
> have ideas (taken from others or developed yourself) about how you're
> going to approach it?

Cool, you've noticed too  ;))

Current theory _really_ seems to be lacking and I'm still busy
trying to come up with an idea that works ...

> My specific concerns are things like:  What will your definition of
> "thrashing" be?  How do you plan to detect it?  When you suspend a
> process, what will happen to that process?  Will its main memory
> allocation be taken away immediately?  When will it be re-activated?

I plan to "detect" thrashing by keeping a kind of "swap load
average", that is, measuring in the same way as the load average
how many tasks are waiting on page faults simultaneously.

When this swap load average will get too high (too high in
relation to the "normal" load average ???) and possibly a few
other conditions are true we will select a process to suspend.

This process will not be suspended immediately, but only on the
next page fault. It's pages will be stolen by kswapd in the normal
way.

We will not start reactivating processes until the swap load is
below the threshold again (which is automatically a reasonable
indication because it's a long-term floating average).

> Basically, these problems used to have easier answers on old batch
> systems with a lesser notion of fairness and more uniform workloads.
> It's not clear what to do here; by suspending processes, you're
> introducing a kind of long-term scheduler that decides when a process
> can enter the pool of candidates from which the usual, short-term
> scheduler chooses.  There seems to be some real scheduling issues that
> go along with this problem, including a substantial modification to
> the fairness with which suspended processes are treated.
> 
> I'd like very much to see a well developed, generalized model for this
> kind of problem.  Obviously, the answer will depend on what the
> intended use of the system is.  It would be wonderful to avoid ad-hoc
> solutions for different cases, and instead have one approach that can
> be adjusted to serve different needs.

Definately.  You can count on me to help think about these things
and help testing, etc...

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-24  5:55               ` Rik van Riel
  2001-03-24  8:04                 ` Mike Galbraith
@ 2001-03-27 14:05                 ` Scott F. Kaplan
  2001-03-28  0:00                   ` Rik van Riel
  1 sibling, 1 reply; 85+ messages in thread
From: Scott F. Kaplan @ 2001-03-27 14:05 UTC (permalink / raw)
  To: linux-mm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 24 Mar 2001, Rik van Riel wrote:

> [...]  I need to implement load control code (so we suspend
> processes in turn to keep the load low enough so we can avoid
> thrashing).

I am curious as to how you plan to go about implementing this load
control.  I ask because it's a current area of research for me.
Detecting the point at which thrashing occurs (that is, the point at
which process utilization starts to fall because every active process
is waiting for page faults, and nothing is ready to run) is not
necessarily easy.

There was a whole bunch of theory about how to detect this kind of
over-commitment with Working Set.  Unfortunately, I'm reasonably
convinced that there are some serious holes in that theory, and that
nobody has developed a well founded answer to this question.  Do you
have ideas (taken from others or developed yourself) about how you're
going to approach it?

My specific concerns are things like:  What will your definition of
"thrashing" be?  How do you plan to detect it?  When you suspend a
process, what will happen to that process?  Will its main memory
allocation be taken away immediately?  When will it be re-activated?

Basically, these problems used to have easier answers on old batch
systems with a lesser notion of fairness and more uniform workloads.
It's not clear what to do here; by suspending processes, you're
introducing a kind of long-term scheduler that decides when a process
can enter the pool of candidates from which the usual, short-term
scheduler chooses.  There seems to be some real scheduling issues that
go along with this problem, including a substantial modification to
the fairness with which suspended processes are treated.

I'd like very much to see a well developed, generalized model for this
kind of problem.  Obviously, the answer will depend on what the
intended use of the system is.  It would be wonderful to avoid ad-hoc
solutions for different cases, and instead have one approach that can
be adjusted to serve different needs.

Scott Kaplan
sfkaplan@cs.amherst.edu

p.s.  I recognize that solving this problem isn't necessarily the
highest priority for Linux.  I'm just curious as to everyone's
thoughts, as I find it an interesting problem.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6wJ4R8eFdWQtoOmgRAtq5AJsE65/+K4tsj8MngAs0uYTw7JTnJQCgkNSz
hMcPq+hdvqADsofb2XOx3Ng=
=I/TJ
-----END PGP SIGNATURE-----

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-26 19:04                 ` James Antill
@ 2001-03-26 20:05                   ` Rik van Riel
  0 siblings, 0 replies; 85+ messages in thread
From: Rik van Riel @ 2001-03-26 20:05 UTC (permalink / raw)
  To: James Antill
  Cc: Guest section DW, Alan Cox, Stephen Clouse, Patrick O'Rourke,
	linux-mm, linux-kernel

On 26 Mar 2001, James Antill wrote:

>  If you want overcommit great, and I think it's a valid default
> ... but it'd be nice if I could say I don't want it for apps that
> aren't written using glib etc.

Agreed.  Jonathan Morton seems to be making progress in testing
and debugging the non-overcommit patch from some time ago. If
things turn out to be trivial enough I wouldn't be surprised if
we got to see the option of non-overcommit somewhere in future
2.4 and 2.5 kernels...

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/


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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:37               ` Rik van Riel
@ 2001-03-26 19:04                 ` James Antill
  2001-03-26 20:05                   ` Rik van Riel
  0 siblings, 1 reply; 85+ messages in thread
From: James Antill @ 2001-03-26 19:04 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Guest section DW, Alan Cox, Stephen Clouse, Patrick O'Rourke,
	linux-mm, linux-kernel

> On Fri, 23 Mar 2001, Guest section DW wrote:
> > On Thu, Mar 22, 2001 at 10:52:09PM +0000, Alan Cox wrote:
> >
> > > You can do overcommit avoidance in Linux if you are bored enough to try it.
> >
> > Would you accept it as the default? Would Linus?
> 
> It wouldn't help.  Suppose you run without overcommit and you
> fill up RAM and swap to the last page.
> 
> Then you change the size of one of the windows on your desktop
> and a program gets sent -SIGWINCH.

 Ignoring the fact that most people don't use a tty based desktop, and
that I'm pretty happy having my desktop die in flames when OOM (my DNS
or smtp server on the other hand...).

>                                    In order to process this
> signal, the program needs to allocate some variables on its
> stack, possibly needing a new page to be allocated for its
> stack ...

man sigaltstack

> ... and since this is something which could happen to any program
> on the system, the result of non-overcommit would be getting a
> random process killed (though not completely random, syslogd and
> klogd would get killed more often than the others).

 I fail to see why, stack usage can be limited (and possibly cleanly
handled by having a prctl() to say make sure X pages are available on
the stack).

 If you want overcommit great, and I think it's a valid default
... but it'd be nice if I could say I don't want it for apps that
aren't written using glib etc.

-- 
# James Antill -- james@and.org
:0:
* ^From: .*james@and\.org
/dev/null
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-25 15:30         ` Martin Dalecki
@ 2001-03-25 20:47           ` Stephen Satchell
  0 siblings, 0 replies; 85+ messages in thread
From: Stephen Satchell @ 2001-03-25 20:47 UTC (permalink / raw)
  To: linux-mm, linux-kernel

At 05:30 PM 3/25/01 +0200, you wrote:
> > Ultra reliable systems dont contain memory allocators. There are good 
> reasons
> > for this but the design trade offs are rather hard to make in a real world
> > environment
>
>I esp. they run on CPU's without a stack or what?

No dynamic memory allocation AT ALL.  That includes the prohibition of a 
stack.  I've seen avionics-loop systems that abstract a stack but the 
"allocators" are part of the application and are designed to fall over 
gracefully when they become full -- but getting this past a project manager 
is hard, as it should be.

Then there are those systems with rather interesting watchdog timers.  If 
you don't tickle them just right, they fire and force a restart.  The 
nastiest of these required that you send four specific values to a specific 
I/O port, and the hardware looked to see if the values violated certain 
timing guidelines.  If you sent the code too early or too late, or if the 
value in the sequence was incorrect, BAM.  The hardware was designed by a 
guy with some rather interesting experiences with software "engineers" 
dealing with watchdog timers...

Satch
   

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-24  5:57                     ` Rik van Riel
@ 2001-03-25 16:35                       ` Guest section DW
  0 siblings, 0 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-25 16:35 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Martin Dalecki, Stephen Clouse, Patrick O'Rourke, linux-mm,
	linux-kernel

On Sat, Mar 24, 2001 at 02:57:27AM -0300, Rik van Riel wrote:
> On Fri, 23 Mar 2001, Guest section DW wrote:
> > On Fri, Mar 23, 2001 at 11:56:23AM -0300, Rik van Riel wrote:
> > > On Fri, 23 Mar 2001, Martin Dalecki wrote:
> > 
> > > > > Feel free to write better-working code.
> > > > 
> > > > I don't get paid for it and I'm not idling through my days...
> > > 
> > >   <similar response from Andries>
> > 
> > No lies please.
> 
> You mean that you ARE willing to implement what you've been
> arguing for?

There had not been any such response by me -
thus you should not ascribe to me such a response.

Concerning overcommit: people tell me that Eduardo Horvath
in his patch submitted to l-k on 2000-03-31 already solved
the problem (entirely or to a large extent).

: This patch will prevent the linux kernel from allowing VM overcommit.

I have not yet read the code.

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:32       ` Alan Cox
  2001-03-23 18:58         ` Martin Dalecki
@ 2001-03-25 15:30         ` Martin Dalecki
  2001-03-25 20:47           ` Stephen Satchell
  1 sibling, 1 reply; 85+ messages in thread
From: Martin Dalecki @ 2001-03-25 15:30 UTC (permalink / raw)
  To: Alan Cox
  Cc: James A. Sutherland, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

Alan Cox wrote:
> 
> > That depends what you mean by "must not". If it's your missile guidance
> > system, aircraft autopilot or life support system, the system must not run
> > out of memory in the first place. If the system breaks down badly, killing
> > init and thus panicking (hence rebooting, if the system is set up that
> > way) seems the best approach.
> 
> Ultra reliable systems dont contain memory allocators. There are good reasons
> for this but the design trade offs are rather hard to make in a real world
> environment

I esp. they run on CPU's without a stack or what?
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-24  5:55               ` Rik van Riel
@ 2001-03-24  8:04                 ` Mike Galbraith
  2001-03-27 14:05                 ` Scott F. Kaplan
  1 sibling, 0 replies; 85+ messages in thread
From: Mike Galbraith @ 2001-03-24  8:04 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm

On Sat, 24 Mar 2001, Rik van Riel wrote:

> On Fri, 23 Mar 2001, george anzinger wrote:
>
> > What happens if you just make swap VERY large?  Does the system thrash
> > it self to a virtual standstill?
>
> It does.  I need to implement load control code (so we suspend
> processes in turn to keep the load low enough so we can avoid
> thrashing).

That would be a nice emergency feature.  I've run into the situation
where the box was thrashing so badly that it was impossible to login
to try to regain control.  Getting a login prompt took nearly forever,
and I could'nt get a passwd entered before login timed-out :)

	-Mike

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:26     ` James A. Sutherland
                         ` (2 preceding siblings ...)
  2001-03-24  0:03       ` Guest section DW
@ 2001-03-24  7:52       ` Doug Ledford
  3 siblings, 0 replies; 85+ messages in thread
From: Doug Ledford @ 2001-03-24  7:52 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

"James A. Sutherland" wrote:
> On Thu, 22 Mar 2001, Guest section DW wrote:
> > (I think 2.4.0.)
> >
> > Clearly, Linux cannot be reliable if any process can be killed
> > at any moment.
> 
> What on earth did you expect to happen when the process exceeded the
> machine's capabilities? Using more than all the resources fails. There
> isn't an alternative.

You might be successful in convincing myself or Andries of this as soon as the
oom killer only kills things when the system is really out of memory.  Right
now, it's not really an oom killer, it's more like an "I'm Too Lazy To Free Up
Some More Pages So Now You Die" (ITLTFUSMPSNYD) killer.

-- 

 Doug Ledford <dledford@redhat.com>  http://people.redhat.com/dledford
      Please check my web site for aic7xxx updates/answers before
                      e-mailing me about problems
--
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/

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

* RE: [PATCH] Prevent OOM from killing init
  2001-03-24  5:54     ` Rik van Riel
@ 2001-03-24  6:55       ` Juha Saarinen
  0 siblings, 0 replies; 85+ messages in thread
From: Juha Saarinen @ 2001-03-24  6:55 UTC (permalink / raw)
  To: Rik van Riel, Szabolcs Szakacsits
  Cc: Patrick O'Rourke, linux-mm, linux-kernel

2.4 or 2.5?

-- Juha
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 16:43                   ` Guest section DW
@ 2001-03-24  5:57                     ` Rik van Riel
  2001-03-25 16:35                       ` Guest section DW
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-24  5:57 UTC (permalink / raw)
  To: Guest section DW
  Cc: Martin Dalecki, Stephen Clouse, Patrick O'Rourke, linux-mm,
	linux-kernel

On Fri, 23 Mar 2001, Guest section DW wrote:
> On Fri, Mar 23, 2001 at 11:56:23AM -0300, Rik van Riel wrote:
> > On Fri, 23 Mar 2001, Martin Dalecki wrote:
> 
> > > > Feel free to write better-working code.
> > > 
> > > I don't get paid for it and I'm not idling through my days...
> > 
> >   <similar response from Andries>
> 
> No lies please.

You mean that you ARE willing to implement what you've been
arguing for?

Cool, I can't wait to see your patch.

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 21:58             ` george anzinger
@ 2001-03-24  5:55               ` Rik van Riel
  2001-03-24  8:04                 ` Mike Galbraith
  2001-03-27 14:05                 ` Scott F. Kaplan
  0 siblings, 2 replies; 85+ messages in thread
From: Rik van Riel @ 2001-03-24  5:55 UTC (permalink / raw)
  To: george anzinger
  Cc: Paul Jakma, Szabolcs Szakacsits, Alan Cox, Stephen Clouse,
	Guest section DW, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, george anzinger wrote:

> What happens if you just make swap VERY large?  Does the system thrash
> it self to a virtual standstill?

It does.  I need to implement load control code (so we suspend
processes in turn to keep the load low enough so we can avoid
thrashing).

> Is this a possible answer?  Supposedly you could then sneak in and
> blow away the bad guys manually ...

This certainly works.

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:31   ` Szabolcs Szakacsits
@ 2001-03-24  5:54     ` Rik van Riel
  2001-03-24  6:55       ` Juha Saarinen
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-24  5:54 UTC (permalink / raw)
  To: Szabolcs Szakacsits; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Szabolcs Szakacsits wrote:

> When I ported your OOM killer to 2.2.x and integrated it into the
> 'reserved root memory' [*] patch, during intensive testing I found two
> cases when init was killed. It happened on low-end machines and when
> OOM killer wasn't triggered so init was killed in the page fault
> handler. The later was also one of the reasons I replaced the "random"
> OOM killer in page fault handler with yours [so there is only one OOM
> killer].

Good idea, we should do this for 2.4.  I cannot remember
reading an email from you about this, it's quite possible
I just missed it and didn't answer because I never read
it ...

> Other things that bothered me,
>  - niced processes are penalized

This can be considered a bug and should be fixed...

>  - trying to kill a task that is permanently in TASK_UNINTERRUPTIBLE
>    will probably deadlock the machine [or the random OOM killer will
>    kill the box].

This could indeed be a problem, though I cannot really see any
case where a task would be in TASK_UNINTERRUPTIBLE permanently.
OTOH, a 1GB read() will take a (much) too long time to finish.

Your ideas sound really good, would you have the time to implement
them for 2.4 ?

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 22:18             ` Szabolcs Szakacsits
@ 2001-03-24  2:08               ` Paul Jakma
  0 siblings, 0 replies; 85+ messages in thread
From: Paul Jakma @ 2001-03-24  2:08 UTC (permalink / raw)
  To: Szabolcs Szakacsits; +Cc: Paul Jakma, linux-mm, Linux Kernel

On Sat, 24 Mar 2001, Szabolcs Szakacsits wrote:

> Nonsense hodgepodge. See and/or mesaure the impact. I sent numbers in my
> former email. You also missed non-overcommit must be _optional_ [i.e.
> you wouldn't be forced to use it ;)]. Yes, there are users and
> enterprises who require it and would happily pay the 50-100% extra swap
> space for the same workload and extra reliability.

ok.. the last time OOM came up, the main objection to fully
guaranteed vm was the possible huge overhead.

if someone knows how to do it without a huge overhead, i'd love to
see it and try it out.

> At every time you add/delete users, add/delete special apps, etc.

no.. pam_limits knows about groups, and you can specify limit for
that group, one time.

@user ... ... ...

> Rik's killer is quite fine at _default_. But there will be always
> people who won't like it

exactly... so lets try avoid ever needing it. it is a last resort.

> default, use the /proc/sys/vm/oom_killer interface"? As I said
> before there are also such patch by Chris Swiedler and definitely
> not a huge, complex one.

uhmm.. where?

> And these stupid threads could be forgotten for good and all.

:)

> 	Szaka

regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org
PGP5 key: http://www.clubi.ie/jakma/publickey.txt
-------------------------------------------
Fortune:
The optimum committee has no members.
		-- Norman Augustine

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:26     ` James A. Sutherland
  2001-03-23 17:32       ` Alan Cox
  2001-03-23 20:16       ` Jordi Polo
@ 2001-03-24  0:03       ` Guest section DW
  2001-03-24  7:52       ` Doug Ledford
  3 siblings, 0 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-24  0:03 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, Mar 23, 2001 at 05:26:22PM +0000, James A. Sutherland wrote:

> > Clearly, Linux cannot be reliable if any process can be killed
> > at any moment.
> 
> What on earth did you expect to happen when the process exceeded the
> machine's capabilities? Using more than all the resources fails. There
> isn't an alternative.

That is the wrong way to phrase these things.
Large processes usually do not have a definite set of needed resources.
They can use lots of memory for buffers and cache and hash and be a bit
faster, or use much less and be a bit slower.
Linux first promises a lot of memory, but then fails to deliver,
without returning any error to the program.

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 19:45           ` Jonathan Morton
@ 2001-03-23 23:26             ` Eric W. Biederman
  0 siblings, 0 replies; 85+ messages in thread
From: Eric W. Biederman @ 2001-03-23 23:26 UTC (permalink / raw)
  To: Jonathan Morton
  Cc: Martin Dalecki, Alan Cox, James A. Sutherland, Guest section DW,
	Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

Jonathan Morton <chromi@cyberspace.org> writes:

> >It would make much sense to make the oom killer
> >leave not just root processes alone but processes belonging to a UID
> >lower
> >then a certain value as well (500). This would be:
> >
> >1. Easly managable by the admin. Just let oracle/www and analogous users
> >   have a UID lower then let's say 500.
> 
> That sounds vaguely sensible.  However, make it a "much less likely" rather
> than an "impossible", otherwise we end up with an unkillable runaway root
> process killing everything else in userland.
> 
> I'm still in favour of a failing malloc(), and I'm currently reading a bit
> of source and docs to figure out where this should be done and why it isn't
> done now.  So far I've found the overcommit_memory flag, which looks kinda
> promising.

Lookup mlock & mlock_all they will handle the single process case.

Of course if you OOM you still have problems but that should make
them much harder to trigger.

Eric
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 22:21                   ` Alan Cox
@ 2001-03-23 22:37                     ` Szabolcs Szakacsits
  0 siblings, 0 replies; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 22:37 UTC (permalink / raw)
  To: Alan Cox
  Cc: Guest section DW, Stephen Clouse, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Alan Cox wrote:
> > > and rely on it. You might find you need a few Gbytes of swap just to
> > > boot
> > Seems a bit exaggeration ;) Here are numbers,
> NetBSD is if I remember rightly still using a.out library styles.

No, it uses ELF today, moreover the numbers were from Solaris. NetBSD
also switched from non-overcommit to overcommit-only [AFAIK] mode with
"random" process killing with its new UVM.

> > 6-50% more VM and the performance hit also isn't so bad as it's thought
> > (Eduardo Horvath sent a non-overcommit patch for Linux about one year
> > ago).
> The Linux performance hit would be so close to zero you shouldnt be able to
> measure it - or it was in 1.2 anyway

Yep, something like this :)

	Szaka

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 20:09                 ` Szabolcs Szakacsits
@ 2001-03-23 22:21                   ` Alan Cox
  2001-03-23 22:37                     ` Szabolcs Szakacsits
  0 siblings, 1 reply; 85+ messages in thread
From: Alan Cox @ 2001-03-23 22:21 UTC (permalink / raw)
  To: Szabolcs Szakacsits
  Cc: Alan Cox, Guest section DW, Stephen Clouse, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

> > and rely on it. You might find you need a few Gbytes of swap just to
> > boot
> 
> Seems a bit exaggeration ;) Here are numbers,

NetBSD is if I remember rightly still using a.out library styles. 

> 6-50% more VM and the performance hit also isn't so bad as it's thought
> (Eduardo Horvath sent a non-overcommit patch for Linux about one year
> ago).

The Linux performance hit would be so close to zero you shouldnt be able to
measure it - or it was in 1.2 anyway
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 20:41           ` Paul Jakma
  2001-03-23 21:58             ` george anzinger
@ 2001-03-23 22:18             ` Szabolcs Szakacsits
  2001-03-24  2:08               ` Paul Jakma
  1 sibling, 1 reply; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 22:18 UTC (permalink / raw)
  To: Paul Jakma
  Cc: Alan Cox, Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Paul Jakma wrote:
> On Fri, 23 Mar 2001, Szabolcs Szakacsits wrote:
> > About the "use resource limits!". Yes, this is one solution. The
> > *expensive* solution (admin time, worse resource utilization, etc).

Thanks for cutting out relevant parts that said how to increase user
base and satisfaction keeping and using the existent possibility as
well.

> traditional user limits have worse resource utilisation? think what
> kind of utilisation a guaranteed allocation system would have. instead
> of 128MB, you'd need maybe a GB of RAM and many many GB of swap for
> most systems.

Nonsense hodgepodge. See and/or mesaure the impact. I sent numbers in my
former email. You also missed non-overcommit must be _optional_ [i.e.
you wouldn't be forced to use it ;)]. Yes, there are users and
enterprises who require it and would happily pay the 50-100% extra swap
space for the same workload and extra reliability.

> - setting up limits on a RH system takes 1 minute by editing
> /etc/security/limits.conf.

At every time you add/delete users, add/delete special apps, etc.
Please note again, some people wants this way, some only for sometimes,
and others really don't care because system guarantees for the admins
they will always have the resources to take action [unfortunately this
is not Linux].

> - Rik's current oom killer may not do a good job now, but it's
> impossible for it to do a /perfect/ job without implementing
> kernel/esp.c.

Rik's killer is quite fine at _default_. But there will be always people
who won't like it [the bastards think humans can still make better
decisions than machines]. Wouldn't it be win for both sides if you could
point out, "Hey, if you don't like the default, use the
/proc/sys/vm/oom_killer interface"? As I said before there are also
such patch by Chris Swiedler and definitely not a huge, complex one.
And these stupid threads could be forgotten for good and all.

> - with limits set you will have:
>  - /possible/ underutilisation on some workloads.

Depends, guaranteed underutilisation or guaranteed extra unreliability
fit the picture many times as well.

> no matter how good or bad Rik's killer is, i'd much rather set limits
> and just about /never/ have it invoked.

Thanks for expressing your opinion but others [not necessarily me] have
"occasionally" other one depending on the job what the box must do.

	Szaka


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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 20:41           ` Paul Jakma
@ 2001-03-23 21:58             ` george anzinger
  2001-03-24  5:55               ` Rik van Riel
  2001-03-23 22:18             ` Szabolcs Szakacsits
  1 sibling, 1 reply; 85+ messages in thread
From: george anzinger @ 2001-03-23 21:58 UTC (permalink / raw)
  To: Paul Jakma
  Cc: Szabolcs Szakacsits, Alan Cox, Stephen Clouse, Guest section DW,
	Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

What happens if you just make swap VERY large?  Does the system thrash
it self to a virtual standstill?  Is this a possible answer?  Supposedly
you could then sneak in and blow away the bad guys manually ...

George

Paul Jakma wrote:
> 
> On Fri, 23 Mar 2001, Szabolcs Szakacsits wrote:
> 
> > About the "use resource limits!". Yes, this is one solution. The
> > *expensive* solution (admin time, worse resource utilization, etc).
> 
> traditional user limits have worse resource utilisation? think what
> kind of utilisation a guaranteed allocation system would have. instead
> of 128MB, you'd need maybe a GB of RAM and many many GB of swap for
> most systems.
> 
> some hopefully non-ranting points:
> 
> - setting up limits on a RH system takes 1 minute by editing
> /etc/security/limits.conf.
> 
> - Rik's current oom killer may not do a good job now, but it's
> impossible for it to do a /perfect/ job without implementing
> kernel/esp.c.
> 
> - with limits set you will have:
>  - /possible/ underutilisation on some workloads.
>  - chance of hitting Rik's OOM killer reduced to almost nothing.
> 
> no matter how good or bad Rik's killer is, i'd much rather set limits
> and just about /never/ have it invoked.
> 
> more beancounting will make limits more useful (eg global?) and maybe
> dists can start setting up some kind of limits by default at install
> time based on the RAM installed and whether user selected
> server/workstation/etc.. install.
> 
> Then hopefully we can be a little less concerned about how close Rik
> gets to the impossible task of implementing esp.c.
> 
> >         Szaka
> 
> --paulj
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 19:26         ` Szabolcs Szakacsits
@ 2001-03-23 20:41           ` Paul Jakma
  2001-03-23 21:58             ` george anzinger
  2001-03-23 22:18             ` Szabolcs Szakacsits
  0 siblings, 2 replies; 85+ messages in thread
From: Paul Jakma @ 2001-03-23 20:41 UTC (permalink / raw)
  To: Szabolcs Szakacsits
  Cc: Alan Cox, Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Szabolcs Szakacsits wrote:

> About the "use resource limits!". Yes, this is one solution. The
> *expensive* solution (admin time, worse resource utilization, etc).

traditional user limits have worse resource utilisation? think what
kind of utilisation a guaranteed allocation system would have. instead
of 128MB, you'd need maybe a GB of RAM and many many GB of swap for
most systems.

some hopefully non-ranting points:

- setting up limits on a RH system takes 1 minute by editing
/etc/security/limits.conf.

- Rik's current oom killer may not do a good job now, but it's
impossible for it to do a /perfect/ job without implementing
kernel/esp.c.

- with limits set you will have:
 - /possible/ underutilisation on some workloads.
 - chance of hitting Rik's OOM killer reduced to almost nothing.

no matter how good or bad Rik's killer is, i'd much rather set limits
and just about /never/ have it invoked.

more beancounting will make limits more useful (eg global?) and maybe
dists can start setting up some kind of limits by default at install
time based on the RAM installed and whether user selected
server/workstation/etc.. install.

Then hopefully we can be a little less concerned about how close Rik
gets to the impossible task of implementing esp.c.

>         Szaka

--paulj

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:26     ` James A. Sutherland
  2001-03-23 17:32       ` Alan Cox
@ 2001-03-23 20:16       ` Jordi Polo
  2001-03-24  0:03       ` Guest section DW
  2001-03-24  7:52       ` Doug Ledford
  3 siblings, 0 replies; 85+ messages in thread
From: Jordi Polo @ 2001-03-23 20:16 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-mm

> What on earth did you expect to happen when the process exceeded the
> machine's capabilities? Using more than all the resources fails. There
> isn't an alternative.

I'll be burnt in fire if i say this but anyway ..... we need the window's 
system , a dinamic grownable swap  .  And if we have no HD then oom kill 
(letting the administrator what processes never be killed by it).
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:40               ` Alan Cox
@ 2001-03-23 20:09                 ` Szabolcs Szakacsits
  2001-03-23 22:21                   ` Alan Cox
  0 siblings, 1 reply; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 20:09 UTC (permalink / raw)
  To: Alan Cox
  Cc: Guest section DW, Stephen Clouse, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

On Thu, 22 Mar 2001, Alan Cox wrote:

> I'd like to have it there as an option. As to the default - You
> would have to see how much applications assume they can overcommit
> and rely on it. You might find you need a few Gbytes of swap just to
> boot

Seems a bit exaggeration ;) Here are numbers,

	http://lists.openresources.com/NetBSD/tech-userlevel/msg00722.html

6-50% more VM and the performance hit also isn't so bad as it's thought
(Eduardo Horvath sent a non-overcommit patch for Linux about one year
ago).

	Szaka

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:00         ` Guest section DW
  2001-03-22 22:12           ` Ed Tomlinson
  2001-03-22 22:52           ` Alan Cox
@ 2001-03-23 19:57           ` Szabolcs Szakacsits
  2 siblings, 0 replies; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 19:57 UTC (permalink / raw)
  To: Guest section DW
  Cc: Alan Cox, Stephen Clouse, Rik van Riel, Patrick O'Rourke,
	linux-mm, linux-kernel

On Thu, 22 Mar 2001, Guest section DW wrote:
> Presently however, a flawless program can be killed.
> That is what makes Linux unreliable.

Your advocation is "save the application, crash the OS!". But you can't
be blamed because everybody's first reaction is this :) But if you start
to think you get the conclusion that process killing can't be avoided if
you want the system keep running. But I agree Linux lacks some important
things [see my other email] that could make the situation easily and
inexpensively controllable.

BTW, your app isn't flawless because it doesn't consider Linux memory
management is [quasi-]overcommit-only at present ;) [or you used other
apps as well, e.g. login, ps, cron is enough to kill your app when it
stopped at OOM time].

	Szaka

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 18:58         ` Martin Dalecki
@ 2001-03-23 19:45           ` Jonathan Morton
  2001-03-23 23:26             ` Eric W. Biederman
  0 siblings, 1 reply; 85+ messages in thread
From: Jonathan Morton @ 2001-03-23 19:45 UTC (permalink / raw)
  To: Martin Dalecki, Alan Cox
  Cc: James A. Sutherland, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

>It would make much sense to make the oom killer
>leave not just root processes alone but processes belonging to a UID
>lower
>then a certain value as well (500). This would be:
>
>1. Easly managable by the admin. Just let oracle/www and analogous users
>   have a UID lower then let's say 500.

That sounds vaguely sensible.  However, make it a "much less likely" rather
than an "impossible", otherwise we end up with an unkillable runaway root
process killing everything else in userland.

I'm still in favour of a failing malloc(), and I'm currently reading a bit
of source and docs to figure out where this should be done and why it isn't
done now.  So far I've found the overcommit_memory flag, which looks kinda
promising.

>1. Processes with a UID < 100 are immune to OOM killers.
>2. Processes with a UID >= 100 && < 500 are hard for the OOM killer to
>take on.
>3. Processes with a UID >= 500 are easy targets.

As I said above, "immune" can be dangerous.  "Extremely hard" would be
better terminology and behaviour.  It also helps that the current weighting
in badness() appears to leave getty processes alone, since they don't
consume much and normally have long uptimes - also I believe init would try
to restart them anyway.

--------------------------------------------------------------
from:     Jonathan "Chromatix" Morton
mail:     chromi@cyberspace.org  (not for attachments)
big-mail: chromatix@penguinpowered.com
uni-mail: j.d.morton@lancaster.ac.uk

The key to knowledge is not to rely on people to teach you it.

Get VNC Server for Macintosh from http://www.chromatix.uklinux.net/vnc/

-----BEGIN GEEK CODE BLOCK-----
Version 3.12
GCS$/E/S dpu(!) s:- a20 C+++ UL++ P L+++ E W+ N- o? K? w--- O-- M++$ V? PS
PE- Y+ PGP++ t- 5- X- R !tv b++ DI+++ D G e+ h+ r++ y+(*)
-----END GEEK CODE BLOCK-----


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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 21:23       ` Alan Cox
                           ` (2 preceding siblings ...)
  2001-03-22 23:43         ` Stephen Clouse
@ 2001-03-23 19:26         ` Szabolcs Szakacsits
  2001-03-23 20:41           ` Paul Jakma
  3 siblings, 1 reply; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 19:26 UTC (permalink / raw)
  To: Alan Cox
  Cc: Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

On Thu, 22 Mar 2001, Alan Cox wrote:

> One of the things that we badly need to resurrect for 2.5 is the
> beancounter work which would let you reasonably do things like
> guaranteed Oracle a certain amount of the machine, or restrict all
> the untrusted users to a total of 200Mb hard limit between them etc

This would improve Linux reliability but it could be much better with
added *optional* non-overcommit (most other OS also support this, also
that's the default mostly [please no, "but it deadlocks" because it's
not true, they also kill processes (Solaris, etc)]), reserved superuser
memory (ala Solaris, True64, etc when OOM in non-overcommit, users
complain and superuser acts, not the OS killing their tasks) and
superuser *advisory* OOM killer [there was patch for this before], I
think in the last area Linux is already more ahead than others at
present.

About the "use resource limits!". Yes, this is one solution. The
*expensive* solution (admin time, worse resource utilization, etc).
Others make it cheaper mixing with the above ones.

        Szaka

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:32       ` Alan Cox
@ 2001-03-23 18:58         ` Martin Dalecki
  2001-03-23 19:45           ` Jonathan Morton
  2001-03-25 15:30         ` Martin Dalecki
  1 sibling, 1 reply; 85+ messages in thread
From: Martin Dalecki @ 2001-03-23 18:58 UTC (permalink / raw)
  To: Alan Cox
  Cc: James A. Sutherland, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

I have a constructive proposal:

It would make much sense to make the oom killer
leave not just root processes alone but processes belonging to a UID
lower
then a certain value as well (500). This would be:

1. Easly managable by the admin. Just let oracle/www and analogous users
   have a UID lower then let's say 500.

2. In full compliance with the port trick done by TCP/IP (ports < 1024
vers other)

3. It wouldn't need any addition of new interface (no jebanoje gawno in
/proc in addition()

4. Really simple to implement/document understand.

5. Be the same way as Solaris does similiar things.

...


Damn: I will let my chess club alone toady and will just code it down
NOW.

Spec:

1. Processes with a UID < 100 are immune to OOM killers.
2. Processes with a UID >= 100 && < 500 are hard for the OOM killer to
take on.
3. Processes with a UID >= 500 are easy targets.

Let me introduce a new terminology in full analogy to "fire walls"
routers and therabouts:

Processes of category 1. are called captains (oficerzy)
Processes of category 2. are called corporals (porucznicy)
Processes of category 2. are called privates (?o3nierze)

;-)
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 17:26     ` James A. Sutherland
@ 2001-03-23 17:32       ` Alan Cox
  2001-03-23 18:58         ` Martin Dalecki
  2001-03-25 15:30         ` Martin Dalecki
  2001-03-23 20:16       ` Jordi Polo
                         ` (2 subsequent siblings)
  3 siblings, 2 replies; 85+ messages in thread
From: Alan Cox @ 2001-03-23 17:32 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

> That depends what you mean by "must not". If it's your missile guidance
> system, aircraft autopilot or life support system, the system must not run
> out of memory in the first place. If the system breaks down badly, killing
> init and thus panicking (hence rebooting, if the system is set up that
> way) seems the best approach.

Ultra reliable systems dont contain memory allocators. There are good reasons
for this but the design trade offs are rather hard to make in a real world
environment

Solving the trivial overcommit case is not a difficult task but since I don't
believe it is needed I'll wait for those who moan so loudly to do it

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
                     ` (4 preceding siblings ...)
  2001-03-22 22:20   ` James A. Sutherland
@ 2001-03-23 17:31   ` Szabolcs Szakacsits
  2001-03-24  5:54     ` Rik van Riel
  5 siblings, 1 reply; 85+ messages in thread
From: Szabolcs Szakacsits @ 2001-03-23 17:31 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Wed, 21 Mar 2001, Rik van Riel wrote:
> One question ... has the OOM killer ever selected init on
> anybody's system ?

Hi Rik,

When I ported your OOM killer to 2.2.x and integrated it into the
'reserved root memory' [*] patch, during intensive testing I found two
cases when init was killed. It happened on low-end machines and when OOM
killer wasn't triggered so init was killed in the page fault handler.
The later was also one of the reasons I replaced the "random" OOM killer
in page fault handler with yours [so there is only one OOM killer]. I
also asked you at that time whether there was any reason you didn't put
it also there but unfortunately you didn't answer. Practice showed it
works there as well [and actually some crashes that was reported here
recently could have been avoided in this way] but technically maybe I
missed something?

Other things that bothered me,
 - niced processes are penalized
 - trying to kill a task that is permanently in TASK_UNINTERRUPTIBLE
   will probably deadlock the machine [or the random OOM killer will
   kill the box].

	Szaka

[*] who are interested, it can be found at
	http://mlf.linux.rulez.org/mlf/ezaz/reserved_root_memory.html

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 11:47   ` Guest section DW
                       ` (2 preceding siblings ...)
  2001-03-22 20:28     ` Stephen Clouse
@ 2001-03-23 17:26     ` James A. Sutherland
  2001-03-23 17:32       ` Alan Cox
                         ` (3 more replies)
  3 siblings, 4 replies; 85+ messages in thread
From: James A. Sutherland @ 2001-03-23 17:26 UTC (permalink / raw)
  To: Guest section DW
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

On Thu, 22 Mar 2001, Guest section DW wrote:
> On Wed, Mar 21, 2001 at 08:48:54PM -0300, Rik van Riel wrote:
> > On Wed, 21 Mar 2001, Patrick O'Rourke wrote:
>
> > > Since the system will panic if the init process is chosen by
> > > the OOM killer, the following patch prevents select_bad_process()
> > > from picking init.
>
> There is a dozen other processes that must not be killed.
> Init is just a random example.

That depends what you mean by "must not". If it's your missile guidance
system, aircraft autopilot or life support system, the system must not run
out of memory in the first place. If the system breaks down badly, killing
init and thus panicking (hence rebooting, if the system is set up that
way) seems the best approach.

> > One question ... has the OOM killer ever selected init on
> > anybody's system ?
>
> Last week I installed SuSE 7.1 somewhere.
> During the install: "VM: killing process rpm",
> leaving the installer rather confused.
> (An empty machine, 256MB, 144MB swap, I think 2.2.18.)

If SuSE's install program needs more than a quarter Gb of RAM, you need a
better distro.

> Last month I had a computer algebra process running for a week.
> Killed. But this computation was the only task this machine had.
> Its sole reason of existence.
> Too bad - zero information out of a week's computation.

A computation your system was incapable of performing. OK, it's a shame it
took you a week to find this out, but the computation had to die: if the
only process running cannot run, it has to die!

> (I think 2.4.0.)
>
> Clearly, Linux cannot be reliable if any process can be killed
> at any moment.

What on earth did you expect to happen when the process exceeded the
machine's capabilities? Using more than all the resources fails. There
isn't an alternative.


James.

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 14:56                 ` Rik van Riel
@ 2001-03-23 16:43                   ` Guest section DW
  2001-03-24  5:57                     ` Rik van Riel
  0 siblings, 1 reply; 85+ messages in thread
From: Guest section DW @ 2001-03-23 16:43 UTC (permalink / raw)
  To: Rik van Riel, Martin Dalecki
  Cc: Stephen Clouse, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, Mar 23, 2001 at 11:56:23AM -0300, Rik van Riel wrote:
> On Fri, 23 Mar 2001, Martin Dalecki wrote:

> > > Feel free to write better-working code.
> > 
> > I don't get paid for it and I'm not idling through my days...
> 
>   <similar response from Andries>

No lies please.

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23 10:48               ` Martin Dalecki
@ 2001-03-23 14:56                 ` Rik van Riel
  2001-03-23 16:43                   ` Guest section DW
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-23 14:56 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

On Fri, 23 Mar 2001, Martin Dalecki wrote:
> Rik van Riel wrote:
> > On Sat, 23 Mar 2002, Martin Dalecki wrote:
> > 
> > > This is due to the broken calculation formula in oom_kill().
> > 
> > Feel free to write better-working code.
> 
> I don't get paid for it and I'm not idling through my days...

  <similar response from Andries>

Well, in that case you'll have to live with the current OOM
killer.  Martin wrote down a pretty detailed description of
what's wrong with my algorithm, if it really bothers him he
should be able to come up with something better.

Personally, I think there is more important VM code to look
after, since OOM is a pretty rare occurrance anyway.

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-23  1:37             ` Rik van Riel
@ 2001-03-23 10:48               ` Martin Dalecki
  2001-03-23 14:56                 ` Rik van Riel
  0 siblings, 1 reply; 85+ messages in thread
From: Martin Dalecki @ 2001-03-23 10:48 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

Rik van Riel wrote:
> 
> On Sat, 23 Mar 2002, Martin Dalecki wrote:
> 
> > This is due to the broken calculation formula in oom_kill().
> 
> Feel free to write better-working code.

I don't get paid for it and I'm not idling through my days...
--
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/

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

* RE: [PATCH] Prevent OOM from killing init
@ 2001-03-23  9:28 Heusden, Folkert van
  0 siblings, 0 replies; 85+ messages in thread
From: Heusden, Folkert van @ 2001-03-23  9:28 UTC (permalink / raw)
  To: Rik van Riel, Tom Kondilis; +Cc: linux-mm, linux-kernel

> That's not the OOM killer however, but init dying because it
> couldn't get the memory it needed to satisfy a page fault or
> somesuch...

Ehrm, I would like to re-state that it still would be nice if
some mechanism got introduced which enables one to set certain
processes to "cannot be killed".
For example: I would hate it it the UPS monitoring daemon got
killed for obvious reasons :o)
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2002-03-23  1:30           ` Martin Dalecki
@ 2001-03-23  1:37             ` Rik van Riel
  2001-03-23 10:48               ` Martin Dalecki
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-23  1:37 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

On Sat, 23 Mar 2002, Martin Dalecki wrote:

> This is due to the broken calculation formula in oom_kill().

Feel free to write better-working code.

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 20:28     ` Stephen Clouse
  2001-03-22 21:01       ` Ingo Oeser
  2001-03-22 21:23       ` Alan Cox
@ 2001-03-23  1:31       ` Michael Peddemors
  2002-03-23  0:33       ` Martin Dalecki
  3 siblings, 0 replies; 85+ messages in thread
From: Michael Peddemors @ 2001-03-23  1:31 UTC (permalink / raw)
  To: Stephen Clouse
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

Here, Here.. killing qmail on a server who's sole task is running mail doesn't seem to make much sense either..

> > Clearly, Linux cannot be reliable if any process can be killed

> > at any moment. I am not happy at all with my recent experiences.
> 
> Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
> logically justify annihilating large-VM processes that have been running for 
> days or weeks instead of just returning ENOMEM to a process that just started 
> up.
> 
> We run Oracle on a development box here, and it's always the first to get the
> axe (non-root process using 70-80 MB VM).  Whenever someone's testing decides to 
> run away with memory, I usually spend the rest of the day getting intimate with
> the backup files, since SIGKILLing random Oracle processes, as you might have
> guessed, has a tendency to rape the entire database.

-- 
"Catch the Magic of Linux..."
--------------------------------------------------------
Michael Peddemors - Senior Consultant
LinuxAdministration - Internet Services
NetworkServices - Programming - Security
WizardInternet Services http://www.wizard.ca
Linux Support Specialist - http://www.linuxmagic.com
--------------------------------------------------------
(604)589-0037 Beautiful British Columbia, Canada

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

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

* Re: [PATCH] Prevent OOM from killing init
  2002-03-23  0:33       ` Martin Dalecki
  2001-03-22 23:53         ` Rik van Riel
@ 2001-03-23  0:20         ` Stephen Clouse
  2002-03-23  1:30           ` Martin Dalecki
  1 sibling, 1 reply; 85+ messages in thread
From: Stephen Clouse @ 2001-03-23  0:20 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

[-- Attachment #1: msg.pgp --]
[-- Type: text/plain, Size: 1917 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Mar 23, 2002 at 01:33:50AM +0100, Martin Dalecki wrote:
> AMEN! TO THIS!
> Uptime of a process is a much better mesaure for a killing candidate
> then it's size.

Thing is, if you take a good study of mm/oom_kill.c, it *does* take start time
into account, as well as CPU time.  The problem is that a process (like Oracle,
in our case) using ludicrous amounts of memory can still rank at the top of the 
list, even with the time-based reduction factors, because total VM is the
starting number in the equation for determining what to kill.  Oracle or what
not sitting at 80 MB for a day or two will still find a way to outrank the
newly-started 1 MB shell process whose malloc triggered oom_kill in the first
place.

If anything, time really needs to be a hard criterion for sorting the final list
on and not merely a variable in the equation and thus tied to vmsize.

This is why the production database boxen aren't running 2.4 yet.  I can control
Oracle's usage very finely (since it uses a fixed memory pool preallocated at
startup), but if something else decides to fire up on there (like the nightly
backup and maintenance routine) and decides it needs just a pinch more memory
than what's available -- ick.  2.2.x doesn't appear to enforce new memory 
allocation with a sniper rifle -- the new process just suffers a pleasant ("Out
of memory!") or violent (SIGSEGV) death.

- -- 
Stephen Clouse <stephenc@theiqgroup.com>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBOrqW3wOGqGs0PadnEQLZUwCfWTr8HwAChQamWWvWWzZcX5DZ8PAAnROB
Ja25OAQu3W1h7Ck0SU/TfKj8
=VlQt
-----END PGP SIGNATURE-----
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2002-03-23  0:33       ` Martin Dalecki
@ 2001-03-22 23:53         ` Rik van Riel
  2002-03-23  1:21           ` Martin Dalecki
  2001-03-23  0:20         ` Stephen Clouse
  1 sibling, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-22 23:53 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: Stephen Clouse, Guest section DW, Patrick O'Rourke, linux-mm,
	linux-kernel

On Sat, 23 Mar 2002, Martin Dalecki wrote:

> Uptime of a process is a much better mesaure for a killing
> candidate then it's size.

You'll have fun with your root shell, then  ;)

The current OOM code takes things like uptime, used cpu, size
and a bunch of other things into account.

If it turns out that the code is not attaching a proper weight
to some of these factors, you should be sending patches, not
flames.

(the code is full of comments, so it should be easy enough to
find your way around the code and tweak it until it does the
right thing in a number of test cases)

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 21:23       ` Alan Cox
  2001-03-22 22:00         ` Guest section DW
  2001-03-22 22:10         ` Doug Ledford
@ 2001-03-22 23:43         ` Stephen Clouse
  2001-03-23 19:26         ` Szabolcs Szakacsits
  3 siblings, 0 replies; 85+ messages in thread
From: Stephen Clouse @ 2001-03-22 23:43 UTC (permalink / raw)
  To: Alan Cox
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

[-- Attachment #1: msg.pgp --]
[-- Type: text/plain, Size: 2353 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Mar 22, 2001 at 09:23:54PM +0000, Alan Cox wrote:
> How do you return an out of memory error to a C program that is out of memory
> due to a stack growth fault. There is actually not a language construct for it

Hmmm...the old "Error 3 while attempting to report Error 3" dialog from MS
Excel.  

> Eventually you have to kill something or the machine deadlocks. The oom killing
> doesnt kick in until that point. So its up to you how you like your errors.

It's interesting that I never recall oom being a problem (like this) with 2.0 or 
2.2.  And the machines I was working with at the time were far crappier than
these current boxen -- they'd ride the oom line almost constantly.  Back then a
new process would either a) scream "Out of memory!" or b) segfault.  You could
argue that b is not desirable, but I'd prefer that to the current behavior, 
really.  In fact this type of behavior still happens under 2.4 when we hit OOM
on the development boxen, although not consistently (only about half the time);
oom_kill annihilates something we don't want it to, then the mallocing process
that triggered it decides it has become bored with life and procceds to
abort/segfault anyway.  I wish I could reproduce it consistently.

In any case, the behavior of oom_kill (whether you consider it correct or
not) is really the symptom and not the cause.  We've alleviated most of it via
creative use of ulimit.  Still, the seemingly draconian behavior needs a bit
finer-grained control.

> One of the things that we badly need to resurrect for 2.5 is the beancounter
> work which would let you reasonably do things like guaranteed Oracle a certain
> amount of the machine, or restrict all the untrusted users to a total of 200Mb
> hard limit between them etc

Let me know when you branch :)  Sounds like a fun project.

- -- 
Stephen Clouse <stephenc@theiqgroup.com>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBOrqOLAOGqGs0PadnEQKWFACfaqzjtUQD4uGaLFnxn6M9Xc4N6QIAoJO3
nJTISp0ekbXEUiAY9PJVf2vr
=B3u4
-----END PGP SIGNATURE-----
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:30             ` Doug Ledford
@ 2001-03-22 23:40               ` Alan Cox
  0 siblings, 0 replies; 85+ messages in thread
From: Alan Cox @ 2001-03-22 23:40 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Alan Cox, Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

> Ummm, yeah, that would pretty much be the claim.  Real easy to reproduce too. 
> Take your favorite machine with lots of RAM, run just a handful of startup
> process and system daemons, then log in on a few terminals and do:
> 
> while true; do bonnie -s (1/2 ram); done
> 
> Pretty soon, system daemons will start to die.

Then thats a bug. I assume you've provided Rik with a detailed test case 
already ?
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:27             ` Guest section DW
  2001-03-22 23:37               ` Rik van Riel
@ 2001-03-22 23:40               ` Alan Cox
  2001-03-23 20:09                 ` Szabolcs Szakacsits
  1 sibling, 1 reply; 85+ messages in thread
From: Alan Cox @ 2001-03-22 23:40 UTC (permalink / raw)
  To: Guest section DW
  Cc: Alan Cox, Stephen Clouse, Rik van Riel, Patrick O'Rourke,
	linux-mm, linux-kernel

> > Even if malloc fails the situation is no different.
> Why do you say so?

Because you will fail on other things - stack overflow, signal delivery,
eventually it will get you. You just cut the odds down. 

> > You can do overcommit avoidance in Linux if you are bored enough to try it.
> 
> Would you accept it as the default? Would Linus?

I'd like to have it there as an option. As to the default - You would have to
see how much applications assume they can overcommit and rely on it. You might
find you need a few Gbytes of swap just to boot

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 23:27             ` Guest section DW
@ 2001-03-22 23:37               ` Rik van Riel
  2001-03-26 19:04                 ` James Antill
  2001-03-22 23:40               ` Alan Cox
  1 sibling, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-22 23:37 UTC (permalink / raw)
  To: Guest section DW
  Cc: Alan Cox, Stephen Clouse, Patrick O'Rourke, linux-mm, linux-kernel

On Fri, 23 Mar 2001, Guest section DW wrote:
> On Thu, Mar 22, 2001 at 10:52:09PM +0000, Alan Cox wrote:
>
> > You can do overcommit avoidance in Linux if you are bored enough to try it.
>
> Would you accept it as the default? Would Linus?

It wouldn't help.  Suppose you run without overcommit and you
fill up RAM and swap to the last page.

Then you change the size of one of the windows on your desktop
and a program gets sent -SIGWINCH. In order to process this
signal, the program needs to allocate some variables on its
stack, possibly needing a new page to be allocated for its
stack ...

... and since this is something which could happen to any program
on the system, the result of non-overcommit would be getting a
random process killed (though not completely random, syslogd and
klogd would get killed more often than the others).

The only solution to not getting processes killed is to run with
enough memory and swap space, having an OOM killer which takes care
to *NOT* let any random innocent process gets killed is nothing but
a bonus, IMHO.

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:53           ` Alan Cox
@ 2001-03-22 23:30             ` Doug Ledford
  2001-03-22 23:40               ` Alan Cox
  0 siblings, 1 reply; 85+ messages in thread
From: Doug Ledford @ 2001-03-22 23:30 UTC (permalink / raw)
  To: Alan Cox
  Cc: Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

Alan Cox wrote:
> 
> > > How do you return an out of memory error to a C program that is out of memory
> > > due to a stack growth fault. There is actually not a language construct for it
> >
> > Simple, you reclaim a few of those uptodate buffers.  My testing here has
> 
> If you have reclaimable buffers you are not out of memory. If oom is triggered
> in that state it is a bug. If you are complaining that the oom killer triggers
> at the wrong time then thats a completely unrelated issue.

Ummm, yeah, that would pretty much be the claim.  Real easy to reproduce too. 
Take your favorite machine with lots of RAM, run just a handful of startup
process and system daemons, then log in on a few terminals and do:

while true; do bonnie -s (1/2 ram); done

Pretty soon, system daemons will start to die.

-- 

 Doug Ledford <dledford@redhat.com>  http://people.redhat.com/dledford
      Please check my web site for aic7xxx updates/answers before
                      e-mailing me about problems
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:52           ` Alan Cox
@ 2001-03-22 23:27             ` Guest section DW
  2001-03-22 23:37               ` Rik van Riel
  2001-03-22 23:40               ` Alan Cox
  0 siblings, 2 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-22 23:27 UTC (permalink / raw)
  To: Alan Cox
  Cc: Stephen Clouse, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

On Thu, Mar 22, 2001 at 10:52:09PM +0000, Alan Cox wrote:

> > You see, the bug is that malloc does not fail. This means that the
> > decisions about what to do are not taken by the program that knows
> > what it is doing, but by the kernel.

> Even if malloc fails the situation is no different.

Why do you say so?

> You can do overcommit avoidance in Linux if you are bored enough to try it.

Would you accept it as the default? Would Linus?

(With disk I/O we are terribly conservative, using very cautious settings,
and many people use hdparm to double or triple their disk speed.
But for a few these optimistic settings cause data corruption,
so we do not make it the default.
Similarly I would be happy if the "no overcommit", "no OOM killer"
situation was the default. The people who need a reliable system
will leave it that way. The people who do not mind if some process
is killed once in a while use vmparm or /proc/vm/overcommit or so
to make Linux achieve more on average.)

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 19:04       ` Guest section DW
@ 2001-03-22 23:10         ` Jordi Polo
  0 siblings, 0 replies; 85+ messages in thread
From: Jordi Polo @ 2001-03-22 23:10 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel

Just a silly thing , think about a system with a process in charge of the 
security of the system, it avoid the script kiddies make funny things with 
it, log every etc. Now think this machine in an OOM situation, what will you 
prefer  trashing and an unusable machine or that oom kill , kills that really 
important process, the machines continues going on and the script kiddies 
make all the fun of it ?
I really think , killing that process is not the right thing and that we have:
1.- make some warnings to the apps, like malloc returning ENOMEM , 
2.- as long as trashing is almost never desired keep the oom kill code but 
make it more powerful allowing the sysadmin to control which pids will NEVER 
get killed even if that means trashing and system going down, we can make 
some pids default reliable like init or things like that but it could be 
changed for instance via /proc

--
Jordi Polo     
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:10         ` Doug Ledford
@ 2001-03-22 22:53           ` Alan Cox
  2001-03-22 23:30             ` Doug Ledford
  0 siblings, 1 reply; 85+ messages in thread
From: Alan Cox @ 2001-03-22 22:53 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Alan Cox, Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

> > How do you return an out of memory error to a C program that is out of memory
> > due to a stack growth fault. There is actually not a language construct for it
> 
> Simple, you reclaim a few of those uptodate buffers.  My testing here has

If you have reclaimable buffers you are not out of memory. If oom is triggered
in that state it is a bug. If you are complaining that the oom killer triggers
at the wrong time then thats a completely unrelated issue.

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:00         ` Guest section DW
  2001-03-22 22:12           ` Ed Tomlinson
@ 2001-03-22 22:52           ` Alan Cox
  2001-03-22 23:27             ` Guest section DW
  2001-03-23 19:57           ` Szabolcs Szakacsits
  2 siblings, 1 reply; 85+ messages in thread
From: Alan Cox @ 2001-03-22 22:52 UTC (permalink / raw)
  To: Guest section DW
  Cc: Alan Cox, Stephen Clouse, Rik van Riel, Patrick O'Rourke,
	linux-mm, linux-kernel

> > Eventually you have to kill something or the machine deadlocks.
> 
> Alan, this is a fake argument.

No it is not.

> You see, the bug is that malloc does not fail. This means that the
> decisions about what to do are not taken by the program that knows
> what it is doing, but by the kernel.

Even if malloc fails the situation is no different. You can do 
overcommit avoidance in Linux if you are bored enough to try it. I did it
in 1.2 one afternoon when bored. You simply account address space. Almost
everything you need to touch is in mm/*.c and localised. The only exception
is ptrace.

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
                     ` (3 preceding siblings ...)
  2001-03-22 19:24   ` Philipp Rumpf
@ 2001-03-22 22:20   ` James A. Sutherland
  2001-03-23 17:31   ` Szabolcs Szakacsits
  5 siblings, 0 replies; 85+ messages in thread
From: James A. Sutherland @ 2001-03-22 22:20 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Wed, 21 Mar 2001, Rik van Riel wrote:

> On Wed, 21 Mar 2001, Patrick O'Rourke wrote:
>
> > Since the system will panic if the init process is chosen by
> > the OOM killer, the following patch prevents select_bad_process()
> > from picking init.
>
> One question ... has the OOM killer ever selected init on
> anybody's system ?

Well, I managed to get the OOM killer killing init once; OTOH, I had just
broken MM completely (disabled freeing of pages entirely!) so that doesn't
really count, I think :-)

> I think that the scoring algorithm should make sure that
> we never pick init, unless the system is screwed so badly
> that init is broken or the only process left ;)

If the system is that badly screwed, killing init is probably the right
thing to do, since this should then cause a panic, and thus a reboot if
the machine is so configured?


James.

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 22:00         ` Guest section DW
@ 2001-03-22 22:12           ` Ed Tomlinson
  2001-03-22 22:52           ` Alan Cox
  2001-03-23 19:57           ` Szabolcs Szakacsits
  2 siblings, 0 replies; 85+ messages in thread
From: Ed Tomlinson @ 2001-03-22 22:12 UTC (permalink / raw)
  To: Guest section DW, Alan Cox, Stephen Clouse
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

On Thursday 22 March 2001 17:00, Guest section DW wrote:
> On Thu, Mar 22, 2001 at 09:23:54PM +0000, Alan Cox wrote:
> > > Really the whole oom_kill process seems bass-ackwards to me.  I can't
> > > in my mind logically justify annihilating large-VM processes that have
> > > been running for days or weeks instead of just returning ENOMEM to a
> > > process that just started up.
> >
> > How do you return an out of memory error to a C program that is out of
> > memory due to a stack growth fault. There is actually not a language
> > construct for it
>
> Alan, this is a fake argument.
> Linux is bad, and you defend it by saying that it is impossible to be
> perfect.
>
> I have used various Unix flavours for approximately thirty years.
> Stack overflow has not been a real problem. Of course they occurred
> every now and then, but roughly speaking only for unchecked recursion,
> that is, in cases of a program bug.
>
> Presently however, a flawless program can be killed.
> That is what makes Linux unreliable.
>
> > Eventually you have to kill something or the machine deadlocks.
>
> Alan, this is a fake argument.
> When I have a computer algebra system, and it computes millions of
> function values for some expensive function, then it keeps a cache
> of already computed values. Maybe a value is needed again and we
> save ten seconds of computation.
> But of course, when we run out of memory, nothing is easier than
> just throwing this cache out.
>
> You see, the bug is that malloc does not fail. This means that the
> decisions about what to do are not taken by the program that knows
> what it is doing, but by the kernel.

By this arguement the OOM kill code is fine...  If malloc is broken fix it.  
Maybe we need to stage things so that ENOMEM gets returned to requests
before we are totally out of memory.  If the apps ignore the errors then the
kills happen.

Thoughts?
Ed Tomlinson
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 21:23       ` Alan Cox
  2001-03-22 22:00         ` Guest section DW
@ 2001-03-22 22:10         ` Doug Ledford
  2001-03-22 22:53           ` Alan Cox
  2001-03-22 23:43         ` Stephen Clouse
  2001-03-23 19:26         ` Szabolcs Szakacsits
  3 siblings, 1 reply; 85+ messages in thread
From: Doug Ledford @ 2001-03-22 22:10 UTC (permalink / raw)
  To: Alan Cox
  Cc: Stephen Clouse, Guest section DW, Rik van Riel,
	Patrick O'Rourke, linux-mm, linux-kernel

Alan Cox wrote:
> 
> > Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
> > logically justify annihilating large-VM processes that have been running for
> > days or weeks instead of just returning ENOMEM to a process that just started
> > up.
> 
> How do you return an out of memory error to a C program that is out of memory
> due to a stack growth fault. There is actually not a language construct for it

Simple, you reclaim a few of those uptodate buffers.  My testing here has
resulting in more of my system daemons getting killed than anything else, and
it never once has solved the actual problem of simple memory pressure from
apps reading/writing to disk and disk cache not releasing buffers quick
enough.

> > It would be nice to give immunity to certain uids, or better yet, just turn the
> > damn thing off entirely.  I've already hacked that in...errr, out.
> 
> Eventually you have to kill something or the machine deadlocks. The oom killing
> doesnt kick in until that point. So its up to you how you like your errors.

I beg to differ.  If you tell me that a machine that looks like this:

[dledford@monster dledford]$ free
             total       used       free     shared    buffers     cached
Mem:       1017800    1014808       2992          0      73644     796392
-/+ buffers/cache:     144772     873028
Swap:            0          0          0
[dledford@monster dledford]$ 

is in need of killing sshd, I'll claim you are smoking some nice stuff ;-)

-- 

 Doug Ledford <dledford@redhat.com>  http://people.redhat.com/dledford
      Please check my web site for aic7xxx updates/answers before
                      e-mailing me about problems
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 21:23       ` Alan Cox
@ 2001-03-22 22:00         ` Guest section DW
  2001-03-22 22:12           ` Ed Tomlinson
                             ` (2 more replies)
  2001-03-22 22:10         ` Doug Ledford
                           ` (2 subsequent siblings)
  3 siblings, 3 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-22 22:00 UTC (permalink / raw)
  To: Alan Cox, Stephen Clouse
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

On Thu, Mar 22, 2001 at 09:23:54PM +0000, Alan Cox wrote:
> > Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
> > logically justify annihilating large-VM processes that have been running for 
> > days or weeks instead of just returning ENOMEM to a process that just started 
> > up.
> 
> How do you return an out of memory error to a C program that is out of memory
> due to a stack growth fault. There is actually not a language construct for it

Alan, this is a fake argument.
Linux is bad, and you defend it by saying that it is impossible to be perfect.

I have used various Unix flavours for approximately thirty years.
Stack overflow has not been a real problem. Of course they occurred
every now and then, but roughly speaking only for unchecked recursion,
that is, in cases of a program bug.

Presently however, a flawless program can be killed.
That is what makes Linux unreliable.

> Eventually you have to kill something or the machine deadlocks.

Alan, this is a fake argument.
When I have a computer algebra system, and it computes millions of
function values for some expensive function, then it keeps a cache
of already computed values. Maybe a value is needed again and we
save ten seconds of computation.
But of course, when we run out of memory, nothing is easier than
just throwing this cache out.

You see, the bug is that malloc does not fail. This means that the
decisions about what to do are not taken by the program that knows
what it is doing, but by the kernel.

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 20:28     ` Stephen Clouse
  2001-03-22 21:01       ` Ingo Oeser
@ 2001-03-22 21:23       ` Alan Cox
  2001-03-22 22:00         ` Guest section DW
                           ` (3 more replies)
  2001-03-23  1:31       ` Michael Peddemors
  2002-03-23  0:33       ` Martin Dalecki
  3 siblings, 4 replies; 85+ messages in thread
From: Alan Cox @ 2001-03-22 21:23 UTC (permalink / raw)
  To: Stephen Clouse
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

> Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
> logically justify annihilating large-VM processes that have been running for 
> days or weeks instead of just returning ENOMEM to a process that just started 
> up.

How do you return an out of memory error to a C program that is out of memory
due to a stack growth fault. There is actually not a language construct for it

> It would be nice to give immunity to certain uids, or better yet, just turn the
> damn thing off entirely.  I've already hacked that in...errr, out.

Eventually you have to kill something or the machine deadlocks. The oom killing
doesnt kick in until that point. So its up to you how you like your errors.

One of the things that we badly need to resurrect for 2.5 is the beancounter
work which would let you reasonably do things like guaranteed Oracle a certain
amount of the machine, or restrict all the untrusted users to a total of 200Mb
hard limit between them etc

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 20:28     ` Stephen Clouse
@ 2001-03-22 21:01       ` Ingo Oeser
  2001-03-22 21:23       ` Alan Cox
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 85+ messages in thread
From: Ingo Oeser @ 2001-03-22 21:01 UTC (permalink / raw)
  To: Stephen Clouse
  Cc: Guest section DW, Rik van Riel, Patrick O'Rourke, linux-mm,
	linux-kernel

On Thu, Mar 22, 2001 at 02:28:31PM -0600, Stephen Clouse wrote:
[Another OOM-Killing thread] 
> It would be nice to give immunity to certain uids, or better
> yet, just turn the damn thing off entirely.  I've already
> hacked that in...errr, out.

That's fine and suits best for all.

I have provided an API for installing such OOM handlers (and have
provided even an simple example for using it).

See http://www.tu-chemnitz.de/~ioe/oom-kill-api/index.html for
details.

It applies to all regular kernels and with some offsets even to
ac20. So this is the way to go for custom OOM handling. 

Rik noted once, that not much research has been done yet on this
topic and that he is certain, that his code cannot cover all
cases.

Linus on the other hand doesn't like the idea of 'plugins' for
core kernel code. 

So this patch is the best thing, that can be done about the
situation.

All work should be based on it, since it allows customers and
researchers, that LIKE to try such 'plugins' to try all of them
instead of having to patch and recompile the kernel for every OOM
handler available.

I would LOVE to start a link collection for all OOM handlers
based on my patch or even host them, IF they are implemented as
modules (as suggested by my API). This should avoid duplicate
effort of this.

Of course I hope to satisfy all needs by this. I'm also willing
to include any API changes (read: exported functions, structs and
variables) necessary for some OOM handlers in my patch.

Thanks & Regards

Ingo Oeser
-- 
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
         <<<<<<<<<<<<     been there and had much fun   >>>>>>>>>>>>
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 11:47   ` Guest section DW
  2001-03-22 15:01     ` Rik van Riel
  2001-03-22 16:41     ` Eric W. Biederman
@ 2001-03-22 20:28     ` Stephen Clouse
  2001-03-22 21:01       ` Ingo Oeser
                         ` (3 more replies)
  2001-03-23 17:26     ` James A. Sutherland
  3 siblings, 4 replies; 85+ messages in thread
From: Stephen Clouse @ 2001-03-22 20:28 UTC (permalink / raw)
  To: Guest section DW
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

[-- Attachment #1: msg.pgp --]
[-- Type: text/plain, Size: 1930 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Mar 22, 2001 at 12:47:27PM +0100, Guest section DW wrote:
> Last week I installed SuSE 7.1 somewhere.
> During the install: "VM: killing process rpm",
> leaving the installer rather confused.
> (An empty machine, 256MB, 144MB swap, I think 2.2.18.)
> 
> Last month I had a computer algebra process running for a week.
> Killed. But this computation was the only task this machine had.
> Its sole reason of existence.
> Too bad - zero information out of a week's computation.
> (I think 2.4.0.)
> 
> Clearly, Linux cannot be reliable if any process can be killed
> at any moment. I am not happy at all with my recent experiences.

Really the whole oom_kill process seems bass-ackwards to me.  I can't in my mind
logically justify annihilating large-VM processes that have been running for 
days or weeks instead of just returning ENOMEM to a process that just started 
up.

We run Oracle on a development box here, and it's always the first to get the
axe (non-root process using 70-80 MB VM).  Whenever someone's testing decides to 
run away with memory, I usually spend the rest of the day getting intimate with
the backup files, since SIGKILLing random Oracle processes, as you might have
guessed, has a tendency to rape the entire database.

It would be nice to give immunity to certain uids, or better yet, just turn the
damn thing off entirely.  I've already hacked that in...errr, out.

- -- 
Stephen Clouse <stephenc@theiqgroup.com>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBOrpgbgOGqGs0PadnEQLp5QCfZMwtDZRNwYQ6RJX0MJ8lRVHTj3YAoNlt
pFWT2i+2y+Yze/6EYy9V0oaE
=QIrK
-----END PGP SIGNATURE-----
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22  8:14   ` Eric W. Biederman
  2001-03-22  9:24     ` Rik van Riel
@ 2001-03-22 19:29     ` Philipp Rumpf
  1 sibling, 0 replies; 85+ messages in thread
From: Philipp Rumpf @ 2001-03-22 19:29 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

On Thu, Mar 22, 2001 at 01:14:41AM -0700, Eric W. Biederman wrote:
> Rik van Riel <riel@conectiva.com.br> writes:
> Is there ever a case where killing init is the right thing to do?

There are cases where panic() is the right thing to do.  Broken init
is such a case.

> My impression is that if init is selected the whole machine dies.
> If you can kill init and still have a machine that mostly works,

you can't.

> Guaranteeing not to select init can buy you piece of mind because
> init if properly setup can put the machine back together again, while
> not special casing init means something weird might happen and init
> would be selected.

If we're in a situation where long-running processes with relatively
small VM are killed the box is very unlikely to be usable anyway.
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
                     ` (2 preceding siblings ...)
  2001-03-22 14:53   ` Patrick O'Rourke
@ 2001-03-22 19:24   ` Philipp Rumpf
  2001-03-22 22:20   ` James A. Sutherland
  2001-03-23 17:31   ` Szabolcs Szakacsits
  5 siblings, 0 replies; 85+ messages in thread
From: Philipp Rumpf @ 2001-03-22 19:24 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Wed, Mar 21, 2001 at 08:48:54PM -0300, Rik van Riel wrote:
> On Wed, 21 Mar 2001, Patrick O'Rourke wrote:
> 
> > Since the system will panic if the init process is chosen by
> > the OOM killer, the following patch prevents select_bad_process()
> > from picking init.
> 
> One question ... has the OOM killer ever selected init on
> anybody's system ?

Yes, I managed to reproduce this a while ago.  (init was the only
process around though).

We don't ever kill init, fwiw;  we panic(), which is the right thing
to do if init can't keep running.

> I think that the scoring algorithm should make sure that
> we never pick init, unless the system is screwed so badly
> that init is broken or the only process left ;)

I can't think of a situation where the OOM killer does the wrong thing.
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 15:01     ` Rik van Riel
@ 2001-03-22 19:04       ` Guest section DW
  2001-03-22 23:10         ` Jordi Polo
  0 siblings, 1 reply; 85+ messages in thread
From: Guest section DW @ 2001-03-22 19:04 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Thu, Mar 22, 2001 at 12:01:43PM -0300, Rik van Riel wrote:

> > Last month I had a computer algebra process running for a week.
> > Killed. But this computation was the only task this machine had.
> > Its sole reason of existence.
> > Too bad - zero information out of a week's computation.
> > 
> > Clearly, Linux cannot be reliable if any process can be killed
> > at any moment. I am not happy at all with my recent experiences.
> 
> Note that the OOM killer in 2.4 won't kick in until your machine
> is out of both memory and swap, see mm/oom_kill.c::out_of_memory().

Nevertheless, this process does malloc and malloc returns the requested
memory. If a malloc fails the computer algebra process has the choice
between various alternatives. Present a prompt, so that the user can
examine variables and intermediate results, or request a dump to disk
of the status of the computation. Or choose an alternative algorithm,
at some other point of the space-time tradeoff curve.
But no error return from malloc - just "Killed". Ach.

Andries
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 16:29 ` Rik van Riel
@ 2001-03-22 18:32   ` Christian Bodmer
  0 siblings, 0 replies; 85+ messages in thread
From: Christian Bodmer @ 2001-03-22 18:32 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm, linux-kernel

I can't say I understand the whole MM system, however the random killing of 
processes seems like a rather unfortunate solution to the problem. If someone 
has a spare minute, maybe they could explain to me why running out of free 
memory in kswapd results in a deadlock situation.

That aside, would it be an improvement to define another process flag 
(PF_OOMPRESERVE) that would declare a process as undesirable to be killed in an 
OOM situation, so that the user has at least some control over what gets killed 
first or last respectively. Only when select_bad_process() runs out of 
unflagged processes will it then proceed to kill the processes with this new 
flag.

Just an idea, I am pretty sure there's tons of reasons why not to introduce a 
new per process flag.

/Cheers
Chris

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 11:47   ` Guest section DW
  2001-03-22 15:01     ` Rik van Riel
@ 2001-03-22 16:41     ` Eric W. Biederman
  2001-03-22 20:28     ` Stephen Clouse
  2001-03-23 17:26     ` James A. Sutherland
  3 siblings, 0 replies; 85+ messages in thread
From: Eric W. Biederman @ 2001-03-22 16:41 UTC (permalink / raw)
  To: Guest section DW
  Cc: Rik van Riel, Patrick O'Rourke, linux-mm, linux-kernel

Guest section DW <dwguest@win.tue.nl> writes:

> On Wed, Mar 21, 2001 at 08:48:54PM -0300, Rik van Riel wrote:
> > On Wed, 21 Mar 2001, Patrick O'Rourke wrote:
> 
> > > Since the system will panic if the init process is chosen by
> > > the OOM killer, the following patch prevents select_bad_process()
> > > from picking init.
> 
> There is a dozen other processes that must not be killed.
> Init is just a random example.

Not killing init provides enough for recovery if you truly hit
an out of memory situation.  With 2.4.x at least it is a box
misconfiguration that causes it.   The 2.2.x VM doesn't always try
to swap, and free things up hard enough, before reporting out of
memory.  But even the 2.2.x problems are rare.

> 
> > One question ... has the OOM killer ever selected init on
> > anybody's system ?
> 
> Last week I installed SuSE 7.1 somewhere.
> During the install: "VM: killing process rpm",
> leaving the installer rather confused.
> (An empty machine, 256MB, 144MB swap, I think 2.2.18.)

swap < RAM. ouch!  This is a misconfiguration on a machine that
actually starts swapping, and where out of memory problems are a
reality.  The fact an installer would trigger swapping on a 256MB
machine is a second problem. 

> Last month I had a computer algebra process running for a week.
> Killed. But this computation was the only task this machine had.
> Its sole reason of existence.
> Too bad - zero information out of a week's computation.
> (I think 2.4.0.)

It looks like you didn't have enough resources on that machine
period.  I pretty much trust 2.4.x in this department.  Did that
machine also have it's swap misconfigured?

> 
> Clearly, Linux cannot be reliable if any process can be killed
> at any moment. I am not happy at all with my recent experiences.

Hmm.  It should definitely not be at any moment.  It should only be
when resources are exhausted.  So putting enough swap on a machine
should be enough, to stop this from ever happening.

Eric
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
       [not found] <4605B269DB001E4299157DD1569079D2809930@EXCHANGE03.plaza.ds.adp.com>
@ 2001-03-22 16:29 ` Rik van Riel
  2001-03-22 18:32   ` Christian Bodmer
  0 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-22 16:29 UTC (permalink / raw)
  To: Tom Kondilis; +Cc: linux-mm, linux-kernel

On Thu, 22 Mar 2001, Tom Kondilis wrote:

> I had a 2.4.3pre3 do a 'Killing Init'
> My assuption is that I had a large benchmark running, while the benchmark
> was running,  I updated inittab to uncomment a mgetty of my serial port, and
> followed it with a 'telinit q'.
> When the system thought it ran out of memory with '1-order allocation
> failures' during a fork, which I think its a defect , because I still have
> 14GB of Swap left in the system. My system was dead.
> A real life case of killing Init.

That's not the OOM killer however, but init dying because it
couldn't get the memory it needed to satisfy a page fault or
somesuch...

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22 11:47   ` Guest section DW
@ 2001-03-22 15:01     ` Rik van Riel
  2001-03-22 19:04       ` Guest section DW
  2001-03-22 16:41     ` Eric W. Biederman
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 85+ messages in thread
From: Rik van Riel @ 2001-03-22 15:01 UTC (permalink / raw)
  To: Guest section DW; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On Thu, 22 Mar 2001, Guest section DW wrote:

> > One question ... has the OOM killer ever selected init on
> > anybody's system ?
> 
> Last week I installed SuSE 7.1 somewhere.
> During the install: "VM: killing process rpm",
> leaving the installer rather confused.
> (An empty machine, 256MB, 144MB swap, I think 2.2.18.)

That's the 2.2 kernel ...


> Last month I had a computer algebra process running for a week.
> Killed. But this computation was the only task this machine had.
> Its sole reason of existence.
> Too bad - zero information out of a week's computation.
> (I think 2.4.0.)
> 
> Clearly, Linux cannot be reliable if any process can be killed
> at any moment. I am not happy at all with my recent experiences.

Note that the OOM killer in 2.4 won't kick in until your machine
is out of both memory and swap, see mm/oom_kill.c::out_of_memory().

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
  2001-03-22  8:14   ` Eric W. Biederman
  2001-03-22 11:47   ` Guest section DW
@ 2001-03-22 14:53   ` Patrick O'Rourke
  2001-03-22 19:24   ` Philipp Rumpf
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 85+ messages in thread
From: Patrick O'Rourke @ 2001-03-22 14:53 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm, linux-kernel

Rik van Riel wrote:


> One question ... has the OOM killer ever selected init on
> anybody's system ?

Yes, which is why I created the patch.

-- 
Patrick O'Rourke
978.606.0236
orourke@missioncriticallinux.com

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
  2001-03-22  8:14   ` Eric W. Biederman
@ 2001-03-22 11:47   ` Guest section DW
  2001-03-22 15:01     ` Rik van Riel
                       ` (3 more replies)
  2001-03-22 14:53   ` Patrick O'Rourke
                     ` (3 subsequent siblings)
  5 siblings, 4 replies; 85+ messages in thread
From: Guest section DW @ 2001-03-22 11:47 UTC (permalink / raw)
  To: Rik van Riel, Patrick O'Rourke; +Cc: linux-mm, linux-kernel

On Wed, Mar 21, 2001 at 08:48:54PM -0300, Rik van Riel wrote:
> On Wed, 21 Mar 2001, Patrick O'Rourke wrote:

> > Since the system will panic if the init process is chosen by
> > the OOM killer, the following patch prevents select_bad_process()
> > from picking init.

There is a dozen other processes that must not be killed.
Init is just a random example.

> One question ... has the OOM killer ever selected init on
> anybody's system ?

Last week I installed SuSE 7.1 somewhere.
During the install: "VM: killing process rpm",
leaving the installer rather confused.
(An empty machine, 256MB, 144MB swap, I think 2.2.18.)

Last month I had a computer algebra process running for a week.
Killed. But this computation was the only task this machine had.
Its sole reason of existence.
Too bad - zero information out of a week's computation.
(I think 2.4.0.)

Clearly, Linux cannot be reliable if any process can be killed
at any moment. I am not happy at all with my recent experiences.

Andries



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

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

* RE: [PATCH] Prevent OOM from killing init
@ 2001-03-22 11:08 Heusden, Folkert van
  0 siblings, 0 replies; 85+ messages in thread
From: Heusden, Folkert van @ 2001-03-22 11:08 UTC (permalink / raw)
  To: Patrick O'Rourke, linux-mm, linux-kernel

> Since the system will panic if the init process is chosen by
> the OOM killer, the following patch prevents select_bad_process()
> from picking init.

Hmmm, wouldn't it be nice to make this all configurable? Like; have
some list of PIDs that can be killed?
I would hate it the daemon that checks my UPS would get killed...
(that deamon brings the machine down safely when the UPS'
batteries get emptied).
Would be something like:

int *dont_kill_pid, ndont_kill_pid;
// initialize with at least pid '1' and n=1

         for_each_task(p) {
		int loop;
		for(loop=ndont_kill_pid-1; loop>=0; loop--)
		{
			if (dont_kill_pid[loop] == p->pid) break;
		}
              if (p->pid && !(loop>=0)) {
                         int points = badness(p);
                         if (points > maxpoints) {
                                 chosen = p;


(untested (not even compiled or anything) code)
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-22  8:14   ` Eric W. Biederman
@ 2001-03-22  9:24     ` Rik van Riel
  2001-03-22 19:29     ` Philipp Rumpf
  1 sibling, 0 replies; 85+ messages in thread
From: Rik van Riel @ 2001-03-22  9:24 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

On 22 Mar 2001, Eric W. Biederman wrote:

> Is there ever a case where killing init is the right thing to do? My
> impression is that if init is selected the whole machine dies. If you
> can kill init and still have a machine that mostly works, then I guess
> it makes some sense not to kill it.
>
> Guaranteeing not to select init can buy you piece of mind because
> init if properly setup can put the machine back together again, while
> not special casing init means something weird might happen and init
> would be selected.

When something weird happens, it might be better to kill
init and have the machine reset itself after the panic
(echo 30 > /proc/sys/kernel/panic).

Killing all other things and leaving just init intact
makes for a machine which is as good as dead, without a
chance for recovery-by-reboot...

OTOH, I haven't heard of the OOM killer ever chosing init,
not even of people who tried creating these special kinds
of situations to trigger it on purpose.

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:48 ` Rik van Riel
@ 2001-03-22  8:14   ` Eric W. Biederman
  2001-03-22  9:24     ` Rik van Riel
  2001-03-22 19:29     ` Philipp Rumpf
  2001-03-22 11:47   ` Guest section DW
                     ` (4 subsequent siblings)
  5 siblings, 2 replies; 85+ messages in thread
From: Eric W. Biederman @ 2001-03-22  8:14 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Patrick O'Rourke, linux-mm, linux-kernel

Rik van Riel <riel@conectiva.com.br> writes:

> On Wed, 21 Mar 2001, Patrick O'Rourke wrote:
> 
> > Since the system will panic if the init process is chosen by
> > the OOM killer, the following patch prevents select_bad_process()
> > from picking init.
> 
> One question ... has the OOM killer ever selected init on
> anybody's system ?
> 
> I think that the scoring algorithm should make sure that
> we never pick init, unless the system is screwed so badly
> that init is broken or the only process left ;)

Is there ever a case where killing init is the right thing to do?
My impression is that if init is selected the whole machine dies.
If you can kill init and still have a machine that mostly works,
then I guess it makes some sense not to kill it.

Guaranteeing not to select init can buy you piece of mind because
init if properly setup can put the machine back together again, while
not special casing init means something weird might happen and init
would be selected.

Eric
--
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/

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 22:54 Patrick O'Rourke
  2001-03-21 23:11 ` Eli Carter
@ 2001-03-21 23:48 ` Rik van Riel
  2001-03-22  8:14   ` Eric W. Biederman
                     ` (5 more replies)
  1 sibling, 6 replies; 85+ messages in thread
From: Rik van Riel @ 2001-03-21 23:48 UTC (permalink / raw)
  To: Patrick O'Rourke; +Cc: linux-mm, linux-kernel

On Wed, 21 Mar 2001, Patrick O'Rourke wrote:

> Since the system will panic if the init process is chosen by
> the OOM killer, the following patch prevents select_bad_process()
> from picking init.

One question ... has the OOM killer ever selected init on
anybody's system ?

I think that the scoring algorithm should make sure that
we never pick init, unless the system is screwed so badly
that init is broken or the only process left ;)

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 23:11 ` Eli Carter
@ 2001-03-21 23:40   ` Patrick O'Rourke
  0 siblings, 0 replies; 85+ messages in thread
From: Patrick O'Rourke @ 2001-03-21 23:40 UTC (permalink / raw)
  To: Eli Carter; +Cc: linux-mm, linux-kernel

Eli Carter wrote:

> Having not looked at the code... Why not "if( p->pid > 1 )"?  (Or can
> p->pid can be negative?!, um, typecast to unsigned...)

I simply mirrored the check done in do_exit():

	if (tsk->pid == 1)
		panic("Attempted to kill init!");

Since PID_MAX is 32768 I do not believe pids can be negative.

I suppose one could make an argument for skipping "daemons", i.e.
pids below 300 (see the get_pid() function in kernel/fork.c), but
I think that is a larger issue.

Pat

-- 
Patrick O'Rourke
978.606.0236
orourke@missioncriticallinux.com

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

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

* Re: [PATCH] Prevent OOM from killing init
  2001-03-21 22:54 Patrick O'Rourke
@ 2001-03-21 23:11 ` Eli Carter
  2001-03-21 23:40   ` Patrick O'Rourke
  2001-03-21 23:48 ` Rik van Riel
  1 sibling, 1 reply; 85+ messages in thread
From: Eli Carter @ 2001-03-21 23:11 UTC (permalink / raw)
  To: Patrick O'Rourke; +Cc: linux-mm, linux-kernel

Patrick O'Rourke wrote:
> 
> Since the system will panic if the init process is chosen by
> the OOM killer, the following patch prevents select_bad_process()
> from picking init.
> 
> Pat
> 
> --- xxx/linux-2.4.3-pre6/mm/oom_kill.c  Tue Nov 14 13:56:46 2000
> +++ linux-2.4.3-pre6/mm/oom_kill.c      Wed Mar 21 15:25:03 2001
> @@ -123,7 +123,7 @@
> 
>          read_lock(&tasklist_lock);
>          for_each_task(p) {
> -               if (p->pid) {
> +               if (p->pid && p->pid != 1) {
>                          int points = badness(p);
>                          if (points > maxpoints) {
>                                  chosen = p;
> 

Having not looked at the code... Why not "if( p->pid > 1 )"?  (Or can
p->pid can be negative?!, um, typecast to unsigned...)

Eli
-----------------------.           Rule of Accuracy: When working toward
Eli Carter             |            the solution of a problem, it always 
eli.carter(at)inet.com `------------------ helps if you know the answer.
--
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/

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

* [PATCH] Prevent OOM from killing init
@ 2001-03-21 22:54 Patrick O'Rourke
  2001-03-21 23:11 ` Eli Carter
  2001-03-21 23:48 ` Rik van Riel
  0 siblings, 2 replies; 85+ messages in thread
From: Patrick O'Rourke @ 2001-03-21 22:54 UTC (permalink / raw)
  To: linux-mm, linux-kernel

Since the system will panic if the init process is chosen by
the OOM killer, the following patch prevents select_bad_process()
from picking init.

Pat

--- xxx/linux-2.4.3-pre6/mm/oom_kill.c  Tue Nov 14 13:56:46 2000
+++ linux-2.4.3-pre6/mm/oom_kill.c      Wed Mar 21 15:25:03 2001
@@ -123,7 +123,7 @@

         read_lock(&tasklist_lock);
         for_each_task(p) {
-               if (p->pid) {
+               if (p->pid && p->pid != 1) {
                         int points = badness(p);
                         if (points > maxpoints) {
                                 chosen = p;

-- 
Patrick O'Rourke
978.606.0236
orourke@missioncriticallinux.com

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

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

end of thread, other threads:[~2002-03-23  1:30 UTC | newest]

Thread overview: 85+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010323015358Z129164-406+3041@vger.kernel.org>
2001-03-23  7:04 ` [PATCH] Prevent OOM from killing init Rik van Riel
2001-03-23 11:28   ` Guest section DW
2001-03-23 14:50     ` Eric W. Biederman
2001-03-23 15:13       ` General 2.4 impressions (was Re: [PATCH] Prevent OOM from killing init) Jeff Garzik
2001-03-23 16:10         ` Adding just a pinch of icache/dcache pressure Jan Harkes
2001-03-23 16:17           ` Andi Kleen
2001-03-23 17:21       ` [PATCH] Prevent OOM from killing init Guest section DW
2001-03-23 20:18         ` Paul Jakma
2001-03-24 20:19           ` Jesse Pollard
2001-03-23 23:48         ` Eric W. Biederman
2001-03-23  9:28 Heusden, Folkert van
     [not found] <4605B269DB001E4299157DD1569079D2809930@EXCHANGE03.plaza.ds.adp.com>
2001-03-22 16:29 ` Rik van Riel
2001-03-22 18:32   ` Christian Bodmer
  -- strict thread matches above, loose matches on Subject: below --
2001-03-22 11:08 Heusden, Folkert van
2001-03-21 22:54 Patrick O'Rourke
2001-03-21 23:11 ` Eli Carter
2001-03-21 23:40   ` Patrick O'Rourke
2001-03-21 23:48 ` Rik van Riel
2001-03-22  8:14   ` Eric W. Biederman
2001-03-22  9:24     ` Rik van Riel
2001-03-22 19:29     ` Philipp Rumpf
2001-03-22 11:47   ` Guest section DW
2001-03-22 15:01     ` Rik van Riel
2001-03-22 19:04       ` Guest section DW
2001-03-22 23:10         ` Jordi Polo
2001-03-22 16:41     ` Eric W. Biederman
2001-03-22 20:28     ` Stephen Clouse
2001-03-22 21:01       ` Ingo Oeser
2001-03-22 21:23       ` Alan Cox
2001-03-22 22:00         ` Guest section DW
2001-03-22 22:12           ` Ed Tomlinson
2001-03-22 22:52           ` Alan Cox
2001-03-22 23:27             ` Guest section DW
2001-03-22 23:37               ` Rik van Riel
2001-03-26 19:04                 ` James Antill
2001-03-26 20:05                   ` Rik van Riel
2001-03-22 23:40               ` Alan Cox
2001-03-23 20:09                 ` Szabolcs Szakacsits
2001-03-23 22:21                   ` Alan Cox
2001-03-23 22:37                     ` Szabolcs Szakacsits
2001-03-23 19:57           ` Szabolcs Szakacsits
2001-03-22 22:10         ` Doug Ledford
2001-03-22 22:53           ` Alan Cox
2001-03-22 23:30             ` Doug Ledford
2001-03-22 23:40               ` Alan Cox
2001-03-22 23:43         ` Stephen Clouse
2001-03-23 19:26         ` Szabolcs Szakacsits
2001-03-23 20:41           ` Paul Jakma
2001-03-23 21:58             ` george anzinger
2001-03-24  5:55               ` Rik van Riel
2001-03-24  8:04                 ` Mike Galbraith
2001-03-27 14:05                 ` Scott F. Kaplan
2001-03-28  0:00                   ` Rik van Riel
2001-03-30  3:18                     ` Scott F. Kaplan
2001-03-30 23:03                       ` Rik van Riel
2001-03-23 22:18             ` Szabolcs Szakacsits
2001-03-24  2:08               ` Paul Jakma
2001-03-23  1:31       ` Michael Peddemors
2002-03-23  0:33       ` Martin Dalecki
2001-03-22 23:53         ` Rik van Riel
2002-03-23  1:21           ` Martin Dalecki
2001-03-23  0:20         ` Stephen Clouse
2002-03-23  1:30           ` Martin Dalecki
2001-03-23  1:37             ` Rik van Riel
2001-03-23 10:48               ` Martin Dalecki
2001-03-23 14:56                 ` Rik van Riel
2001-03-23 16:43                   ` Guest section DW
2001-03-24  5:57                     ` Rik van Riel
2001-03-25 16:35                       ` Guest section DW
2001-03-23 17:26     ` James A. Sutherland
2001-03-23 17:32       ` Alan Cox
2001-03-23 18:58         ` Martin Dalecki
2001-03-23 19:45           ` Jonathan Morton
2001-03-23 23:26             ` Eric W. Biederman
2001-03-25 15:30         ` Martin Dalecki
2001-03-25 20:47           ` Stephen Satchell
2001-03-23 20:16       ` Jordi Polo
2001-03-24  0:03       ` Guest section DW
2001-03-24  7:52       ` Doug Ledford
2001-03-22 14:53   ` Patrick O'Rourke
2001-03-22 19:24   ` Philipp Rumpf
2001-03-22 22:20   ` James A. Sutherland
2001-03-23 17:31   ` Szabolcs Szakacsits
2001-03-24  5:54     ` Rik van Riel
2001-03-24  6:55       ` Juha Saarinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox