mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Morton <chromi@cyberspace.org>
To: james <jdickens@ameritech.net>, Rik van Riel <riel@conectiva.com.br>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: Ideas for the oom problem
Date: Wed, 28 Mar 2001 06:52:14 +0100	[thread overview]
Message-ID: <l03130300b6e7282c3def@[192.168.239.101]> (raw)
In-Reply-To: <01032718343500.32154@friz.themagicbus.com>

I'm going to be gentle here and try to point out where your suggestions are
flawed...

>a. don't kill any task with a uid < 100

Suppose your system daemon springs a leak?  It will have to be killed
eventually, however system daemons can sensibly be given a little "grace".
Also, the UIDs used by a system daemon vary from system to system.

>b. if uid between 100 to 500 or CAP-SYS equivalent enabled
>	set it too a lower priority, so if it is at fault it will happen
>slower
>            giving more time before the system collapses

Not slowly enough.  When your system is thrashing, the CPU is the resource
under least pressure, so "nice" values and priorities have virtually zero
effect.  In any case, under OOM conditions the system has *already*
collapsed and we *have* to kill something for the system to keep running.

>c.  if a task is nice'd then immediately put the task too sleep, and schedule
>all code / data too be swapped out, or thrown away as appropiate. do not
>reschedule the task too continue until memory is available

In OOM conditions there is no swap space left to do what you suggest.  This
is a sensible solution for when thrashing is the only problem...

>d. kill any normal user interactive tasks that is started during a memory
>crisis.

Define "memory crisis".  However, this is a relatively sensible solution.

>allocate a pool of memory at system start up that is too be released to the
>memory pool when the system is in a memory crisis. This will reduce system
>swapping, and allow the system too stablize slightly

One of my patches already tries to do this, in a way.  It doesn't yet
provide a hard barrier, but it does prevent applications from hogging the
entire memory on the system (at least, without expending some effort into
it).

>report any task asking for large pool of memory while the system is in
>oom crisis. if uid > 500 and was started from an interactive shell it should
>be killed.

See above.  malloc() fails, which tells the application there is no more
memory in the system.  A well-written application will respond to this and
use more memory-conservative techniques.  A poorly-written application will
segfault.  End Of Problem.  Now to make memory accounting work properly so
these tests are reliable...

>when the crisis is ended, re-adquire the memory pool for later usage.

It is never given up, except when it is needed by the kernel itself (eg. to
swap in pages or (in the absence of true memory accounting) to provide COW
space.

>Prong 3 providing  information about oom crisis too user land
>
>create /proc/vm/oom_crisis this would be readonly file owned by root it would
>report if the system is in crisis and the uid of any process that is asking
>for large amounts of ram while the system
>is in crisis.

This kind of information is already available using /proc - applications
just have to look int he right places.

>create a SIGDANGER handler that is sent out too all tasks that have
>registered a handler when the kernel enters oom_kill, give these tasks a high
>priority access too system resources.

This is a fairly good idea, why does it look so familiar?  :)  SIGDANGER
would be sent to all processes when memory availablility goes below a
threshold, ie. when there is still enough memory left to handle the
situation.  The default handler would be a no-op, preserving compatibility.
However, the notion of "high priority access to resources" is not currently
feasible (or necessary).

>this would enable user land programs too deal with the situation with out
>continuous polling free ram/swap. They could email/page sysadmin and user
>about the crisis and add additional swap resources and kill any know  non
>essential tasks. and probe system for possible broken tasks, such as
>netscape-common tasks not connected too netscape client, at least i have been
>known too find these when netscape crashes.

Interesting applications for this signal.  However, this is entirely a
userspace issue as to what to do with the signal - the kernel's job is to
provide it (if we decide to, that is).

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



  parent reply	other threads:[~2001-03-28  5:53 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-27 21:29 [PATCH] mm/memory.c, 2.4.1 : memory leak with swap cache (updated) Richard Jerrell
2001-03-27 21:18 ` Rik van Riel
2001-03-27 23:10   ` Richard Jerrell
2001-03-27 22:57     ` Rik van Riel
2001-03-28  0:53   ` Ideas for the oom problem james
2001-03-28  0:52     ` Rik van Riel
2001-03-28  1:14       ` Doug Ledford
2001-03-28  3:21         ` Rik van Riel
2001-03-28  3:41           ` Doug Ledford
2001-03-28  3:53             ` Rik van Riel
2001-03-28  1:39       ` james
2001-03-28  5:52     ` Jonathan Morton [this message]
2001-03-28  6:16       ` Disturbing news Shawn Starr
2001-03-28  6:33         ` Disturbing news.. Idea Shawn Starr
2001-04-21  0:43           ` Serious Latency problems : 2.4.4-pre5 Shawn Starr
2001-03-28  7:19         ` Disturbing news Matti Aarnio
2001-03-28  7:27           ` Shawn Starr
2001-03-28 12:08             ` Jesse Pollard
2001-03-28  5:50               ` Ben Ford
2001-03-28 12:50               ` Walter Hofmann
2001-03-28 14:04                 ` Simon Williams
2001-03-28 15:04                   ` Olivier Galibert
2001-03-28 15:49                     ` Simon Williams
2001-03-28 11:57                       ` Ben Ford
2001-03-29  8:02                         ` Helge Hafting
2001-03-28 17:51                       ` Olivier Galibert
2001-03-28 12:53               ` Keith Owens
2001-03-28 13:00               ` Russell King
2001-03-28 14:10               ` Sean Hunter
2001-03-28 15:36                 ` john slee
2001-03-28 16:18                   ` Jonathan Lundell
2001-04-02 23:10               ` Dr. Kelsey Hudson
2001-03-28 17:29             ` Horst von Brand
2001-03-28 10:00         ` Helge Hafting
2001-03-28 13:25         ` Alexander Viro
2001-03-28 14:32           ` Romano Giannetti
2001-03-28 14:57             ` Bill Rugolsky Jr.
2001-03-28 14:57             ` Alexander Viro
2001-03-28 16:14               ` Romano Giannetti
2001-03-28 14:38     ` Ideas for the oom problem Hacksaw
2001-03-28 15:56       ` Andreas Rogge
2001-03-28 23:33         ` Hacksaw
2001-03-28 23:47           ` Tim Haynes
2001-03-29  0:12             ` Hacksaw
2001-03-27 21:51 ` [PATCH] mm/memory.c, 2.4.1 : memory leak with swap cache (updated) Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='l03130300b6e7282c3def@[192.168.239.101]' \
    --to=chromi@cyberspace.org \
    --cc=jdickens@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®