Re: What to do when out of memory

From: Helge Hafting (helgehaf@idb.hist.no)
Date: Mon Jan 24 2000 - 06:55:27 EST


> Hi,
>
> I want to bring up a topic that I have never heard dicussed but have had
> major problems with myself.
>
> The basic problem is that if I run a program that eats up all the memory
> on the system than the kernel will start swapping crazilly and make the
> system completely unresponsive.
Is this a real problem, or some memory eater you made to make the point?

If you use up real memory then the system does its best by swapping. It
doesn't
die, jsut slow down. This is usually a graceful process with real-world
programs. Stuff get gradually slower as more meomory is used up.

Now, if you use *way* too much memory then the only solutions
is more memory or fewer programs. There are no other ways, no other
os can save you either.

> It may take a minute or two to get its
> attention,
Definitely, if you swap way too much. Install more RAM or move some
apps to another machine.

> or it may be completely locked up. From what I have seen, this
It is not supposed to lock up, that may be a bug. Or maybe you
are impatient, you may need to wait some more.

> is not acceptable behavior nor is it what I would expect from any
> UNIX-like operating system.
>
> I know that your first impulse will be to tell me to set PAM's limits.conf
> or a limits option within my shell. I think this is irrelevant. Regardless
> of userspace settings, the kernel should handle OOM situations more
> gracefully than swapping to death. This may be a gross oversimplification
HOW?

> of the problem (as I have no kernel hacking experience or knowledge), but
> can't the kernel just deny memory allocations if all the memory on the
> system is in use?
Well, that is precisely what the limits is there for. But you refuse to
use them.
Some people need the ability to over-allocate, they need some huge job
to complete even if it takes ages of swapper hell.
Limits exists for those who need the interactive performance, or
protection
from nasty users.

> Maybe there should be a few K of ram that can never be
> allocated into just so the kernel can recover from a situation like this.

You can always do tricks like having root running "top at a very high
priority at some console/terminal. This will usually be responsive
enough, and may be used for killing memory eaters. Note that "top"
isn't enough, it must run with unusually high priority too. Set it to
update often, like twice a second perhaps. It's pages will likely not
be
swapped out much under these circumstances. Make sure nobody
unauthorized
can get to this console/terminal.

Helge Hafting

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:12 EST