Re: Out of memory kernel death

Tim Hollebeek (tim@franck.Princeton.EDU)
Thu, 8 May 1997 13:15:50 -0400 (EDT)

James Mastros writes ...
> On Wed, 7 May 1997, bert hubert wrote:
> >
> > On Wed, 7 May 1997, Theodore Y. Ts'o wrote:
> >
> > > looks through the processes and kills off the largest one.
> > > This should be doable in Linux too...
> > >
> > > The problem is that the largest process is often the X server. Often
> > > this will indeed free a lot of memory, but it's not necessarily the best
> > > thing to do...
> >
> > This is getting uglier & uglier, but let's be pragmatic and make it kill
> > the largest process NOT called "X".
> >
> > bert hubert.
> >
> Or ending in "d" (as in daemon)? Or before "e" except after "c", or when
> sounding like "ahy" as in "neighoubor" or "wheiy?" <SP>? Where does the
> uglyness stop? If we are going to do somthing like this, lets do it
> right. How does adding in "with no sub-processes" sound?

The situation we do *not* want to get into is where we kill a process that
was not causing the problem, the problem process eats up even more memory,
then we kill another process that is not the problem, .... ad nauseum.

How do you avoid this? Obviously we want to kill the process that, if
left alive, would most quickly eat all the available memory if such a
process exists. We can't predict the future, but we *can* figure out
who has been allocating memory the fastest in the past and assume this
is likely to continue. So I suggest killing the process with the
(highest total size/running time); the X server and other large, but
long running processes should be quite low on that list. If you want
an even more accurate heuristic, a bit of overhead can be added to track
number of page allocations during the last <arbitrary time period> or
a decaying "memory demand" load average. But those are more complex.

Tim Hollebeek | Disclaimer :=> Everything above is a true statement,
Electron Psychologist | for sufficiently false values of true.
Princeton University | email:
----------------------| (NEW! IMPROVED!)