Re: Overcommitable memory??

From: James Sutherland (jas88@cam.ac.uk)
Date: Sun Mar 19 2000 - 15:36:32 EST


On 18 Mar 2000 01:20:40 GMT, you wrote:

>On 17 Mar 2000 00:27:42 +0100, Rask Ingemann Lambertsen <rask-linux@kampsax.k-net.dk> wrote:
>>Den 15-Mar-00 11:49:45 skrev James Sutherland følgende om "Re: Overcommitable memory??":
>>> On Wed, 15 Mar 2000, David Whysong wrote:
>>
>>>> The only possibilities are to (a) enforce hard memory limits with no
>>>> overcommit, thereby wasting large amounts of swap space that will never
>>>> get used while not really solving the problem,
>>
>>> As well as *destroying* performance (you'd effectively eliminate COW
>>> capability on fork - if your 500Mb simulation wants to fork a 100k mailer
>>> process to send you an update, the kernel has to allocate and copy 500Mb
>>> of RAM/swap first, then discard it all again.)
>>
>> Not at all. COW is a performance optimisation which does not depend on
>>overcommitment of memory in any way. Why would you want to turn it off?
>
>Say you have 800MB virtual RAM, and you simulation currently uses 500MB.
>And now, it tries to fork(2). Do you allow it, or does fork fail with
>-ENOMEM ? If you allow it, and one copy later just writes different data to
>say 400MB of itself, it will run out of memory (because system will need to
>create new page for COW, and would need 500MB+400MB, which is more than
>800MB virtual RAM your machine have). Ka-boom, you process will die on
>simple memory access (no syscall to check error from, since you allowed that
>fork() which was last place to check it).

Yes - it dies, because it overran a memory limit. In the first
situation, it dies immediately (failed fork()) because it COULD, IN
THEORY, have used more memory than available (as could the parent at
any time anyway, but we'll ignore that for now). In the second, it is
allowed to survive, provided it doesn't exhaust the memory limits. If
it does, it is killed for it.

I much prefer the second - it allows operations to succeed where
possible.

James.

-
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 : Thu Mar 23 2000 - 21:00:27 EST