• Andries E. Brouwer's avatar
    [PATCH] mm: overcommit updates · ea86630e
    Andries E. Brouwer authored
    Alan made overcommit mode 2 and it doesnt work at all.  A process passing
    the limit often does so at a moment of stack extension, and is killed by a
    segfault, not better than being OOM-killed.
    
    Another problem is that close to the edge no other processes can be
    started, so that a sysadmin has problems logging in and investigating.
    
    Below a patch that does 3 things:
    
    (1) It reserves a reasonable amount of virtual stack space (amount
        randomly chosen, no guarantees given) when the process is started, so
        that the common utilities will not be killed by segfault on stack
        extension.
    
    (2) It reserves a reasonable amount of virtual memory for root, so that
        root can do things when the system is out-of-memory
    
    (3) It limits a single process to 97% of what is left, so that also an
        ordinary user is able to use getty, login, bash, ps, kill and similar
        things when one of her processes got out of control.
    
    Since the current overcommit mode 2 is not really useful, I did not give
    this a new number.
    
    The patch is just for playing, not to be applied by Linus.  But, Andrew, I
    hope that you would be willing to put this in -mm so that people can
    experiment.  Of course it only does something if one sets overcommit mode
    to 2.
    
    The past month I have pressured people asking for feedback, and now have
    about a dozen reports, mostly positive, one very positive.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    ea86630e
exec.c 31.7 KB