Re: [PATCH] Remove OOM killer from try_to_free_pages / all_unreclaimable braindamage

Werner Almesberger
2004-11-17T22:59:42Z

Entering an old discussion ...

Thomas Gleixner wrote:
> context in which oom-killer is called. My concern is that the decision
> critrion which process should be killed is not sufficient. In my case it
> kills sshd instead of a process which forks a bunch of child processes.

It recently occurred to me that we could have relatively light-weight
voluntary victimization for known trouble-makers. E.g. in a desktop
environment, the cause for trouble seems to be almost always the Web
browser, or something closely related to it.

A process could declare itself as usual suspect. This would then be
recorded as a per-task flag, to be inherited by children. Now, one
could write a launcher like this:

int main(int argc,char **argv)
{
if (argc < 2) {
fprintf(stderr,"usage: %s command [arguments...]\n",*argv);
return 1;
}
sys_suspect_me();
execvp(argv[1],argv+1);
perror(argv[1]);
return 1;
}

And then something like

# mv /usr/bin/browser /usr/bin/browser.bin
# echo '#!/bin/sh' >/usr/bin/browser
# echo 'suspect_me /usr/bin/browser.bin "$@"' >>/usr/bin/browser
# chmod 555 /usr/bin/browser

or use an alias if you like your packet manager.

Not sure if this would actually be useful in real life, but it looks
at least like a relatively simple and flexible solution to a part of
the selection problem.

One could even consider getting rid of the suspects a while before
hitting OOM, so that the system doesn't have to slow down before the
inevitable killing.

Not that'm getting many OOMs these days - my VNC setup is quite good
at dying well before anything serious turns up :-(

- Werner

--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/