Re: Overcommitable memory??

From: Jesse Pollard (pollard@cats-chateau.net)
Date: Sat Mar 18 2000 - 09:03:34 EST


On Fri, 17 Mar 2000, Matija Nalis 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).

That was why I was suggesting to allow 5-10 pages of reserve memory for
a fork. If the child process doesn't write to more than that amount of
memory (ie writing some portion of data to disk, printing a file...) then
it wouldn't have to have 100% reserved space for a copy of the data space.
I think this would cover 90% of the cases where fork would/could cause
an out-of-reserve condition (NOTE: Out-Of-Reserve only affects the process
that is adding the extra space, not the system in general, the out-of-memory
failure. Most of the forks done are "fork/exec". Data processing functions
that do "fork - lots of compute" would still need the data reserve.
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@cats-chateau.net

Any opinions expressed are solely my own.

-
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:24 EST