Re: Avoiding OOM on overcommit...?

From: David Whysong (dwhysong@physics.ucsb.edu)
Date: Fri Mar 24 2000 - 17:24:54 EST


On Fri, 24 Mar 2000, Alexander Viro wrote:
>On Fri, 24 Mar 2000, David Whysong wrote:
>> On Fri, 24 Mar 2000, Alexander Viro wrote:
>> >RTFComments. Sharing of text pages is unrelated to overcommit.
>>
>> But demand loading certainly is related to overcommit, unless the kernel
>> was careful to count how many pages it hasn't loaded yet?
>
>There are _text_ pages. As in "ones that can be thrown away at any
>moment". Check what part of the binaries is mapped with write allowed.
>That's where demand loading may have something with overcommit.

And there are also data pages. From 1.0, fs/exec.c:

error = do_mmap(file, N_TXTADDR(ex) + ex.a_text, ex.a_data,
                PROT_READ | PROT_WRITE | PROT_EXEC,
                MAP_FIXED | MAP_PRIVATE, N_TXTOFF(ex) +
                ex.a_text);

do_mmap is also called for text, read-only.

The comments say:

 * Demand-loading implemented 01.12.91 - no need to read anything but
 * the header into memory. The inode of the executable is put into
 * "current->executable", and page faults do the actual loading. Clean.

and later

 * Demand loading changed July 1993 by Eric Youngdale. Use mmap instead,
 * current->executable is only used by the procfs.

Looks to me like data was demand loaded in early kernels... and we're
completely ignoring stack growth, of course.

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