Re: Avoiding OOM on overcommit...?

From: David Whysong (dwhysong@physics.ucsb.edu)
Date: Fri Mar 24 2000 - 16:00:36 EST


On Fri, 24 Mar 2000, Marco Colombo wrote:
>On 22 Mar 2000, Olaf Weber wrote:

>No problem. Is is problem that your program gets stoppen when it gets
>SIGTSTP? If no, you don't have to use any "special programming techniques".
>If yes, you may think of trapping the signal and inform the user that
>stopping your application is not possible. Are you concerned of your
>program being killed at OOM time? Use special techniques to avoid
>triggering the OOM killer (i.e., do not page-fault). It's harder
>than just using signal(), i admit it. It may also be impossible to do
>in a really "safe" way (your stack may grow...).

It's completely impossible to avoid a page fault (as it should be). You
page fault, if (for example) the kernel has swapped out your data, or
dropped your executable pages on the floor, it will later need to read
them back into memory.

Yes, mlock() solves this, but only root can mlock(). That's not a good
solution for users.

>IFAIK, older linux versions had no overcommitting. The kernel *evolved*
>from a non-overcommitting mm to a overcommitting one.

No, it has overcommitted memory almost since the beginning. These comments
are from linux 1.0.0, in mm/memory.c. Note the dates:

/*
 * demand-loading started 01.12.91 - seems it is high on the list of
 * things wanted, and it should be easy to implement. - Linus
 */

/*
 * Ok, demand-loading was easy, shared pages a little bit tricker. Shared
 * pages started 02.12.91, seems to work. - Linus.
 *
 * Tested sharing by executing about 30 /bin/sh: under the old kernel it
 * would have taken more than the 6M I have free, but it worked well as
 * far as I could see.
 *
 * Also corrected some "invalidate()"s - I wasn't doing enough of them.
 */

Dave

David Whysong dwhysong@physics.ucsb.edu
Astrophysics graduate student University of California, Santa Barbara
My public PGP keys are on my web page - http://www.physics.ucsb.edu/~dwhysong
DSS PGP Key 0x903F5BD6 : FE78 91FE 4508 106F 7C88 1706 B792 6995 903F 5BD6
D-H PGP key 0x5DAB0F91 : BC33 0F36 FCCD E72C 441F 663A 72ED 7FB7 5DAB 0F91

-
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 : Fri Mar 31 2000 - 21:00:13 EST