Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 16:05:55 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Mike Silbersack <silby@silby.com>
Cc:        Poul-Henning Kamp <phk@phk.freebsd.dk>, "Daniel C. Sobral" <dcs@tcoip.com.br>, Juli Mallett <jmallett@FreeBSD.org>, Eivind Eklund <eivind@FreeBSD.org>, David Schultz <das@FreeBSD.org>, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/vm ... SIGDANGER
Message-ID:  <p05200f2cba97ef395f0e@[128.113.24.47]>
In-Reply-To: <20030314140414.V4480@odysseus.silby.com>
References:  <8023.1047662161@critter.freebsd.dk> <p05200f2bba97e5a92150@[128.113.24.47]> <20030314140414.V4480@odysseus.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 2:15 PM -0600 3/14/03, Mike Silbersack wrote:
>On Fri, 14 Mar 2003, Garance A Drosihn wrote:
>
>>  The web page I gave in my other message also talks about a
>>  'psdanger' routine, which sounds like it might be what you're
>>  talking about.
>>
>>  [of course, as a userland-type-of-programmer, I'm hoping some
>>  kernel-type will get excited about the idea and implement the
>  > same set of ideas for FreeBSD. :-)]
>
>I'm really not sure how much of a help this SIGDANGER or whatever
>will be.  As I see it, there are two cases of OOM:
>
>1.  Heavy load, lots of busy processes, all legitimate.
>     - Nobody has complained about this case having problems.
>
>2.  Light load, then some program goes crazy and forks / chews
>     up ram.  X  gets killed.
>     - I think this is what people are complaining about.
>
>In case #2, SIGDANGER wouldn't help much; how much ram can the
>actively running, legitimate programs really save?

Uh, in case #2, you would change X to have a SIGDANGER signal-handler,
and have that signal-handler simply "Do Nothing" and return.  Thus,
the mere presence of the signal-handler will make sure that X is never
the thing that gets killed.  The SIGDANGER signal-handler that I
added to 'lpd' (at RPI) has the name "ignore_danger"...

Note that I had first-hand experience with this very scenario, and I
found that SIGDANGER (as implemented in AIX) *did* let me do what I
needed to do.  And the only program I changed was 'lpd'.  I didn't
have to track down every student on the RPI campus and tell them to
"behave", or to "please do not write fork-bombs while doing your
systems-programming project", either of which would be a hopeless
proposition.  It is definitely a help.  It is definitely better than
the nothing that FreeBSD currently provides.

If FreeBSD also had a psdanger routine, for programs which *do* want
to monitor the swapping-situation, that would benefit a different set
of situations.  Taken together, it'd be a very nice step forward.

>What might be a good solution is to use some sort of statistics
>basic heuristic when determining what to kill.

The SIGDANGER strategy is proven to work, and it should be much
easier to implement.  SIGDANGER is also attractive in that anyone
who is already using SIGDANGER for AIX would then benefit when
moving to FreeBSD, and any program using it on FreeBSD would then
have it if some unfortunate soul had to port the program to AIX.

Add sysctl's to set the two threshold levels, and the admin would
even have a way to tune the behavior (well, a little).

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-src" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05200f2cba97ef395f0e>