Re: Avoiding OOM on overcommit...?

From: Andreas Bombe (andreas.bombe@munich.netsurf.de)
Date: Mon Mar 27 2000 - 15:55:23 EST


On Mon, Mar 27, 2000 at 11:07:12AM +0200, Peter T. Breuer wrote:
> "A month of sundays ago David Whysong wrote:"
> >[ptb wrote]
> > >And I arrived later too. But while we're on the subject of swap space,
> > >doesn't "reserve me 8MB of disk-based swap as backing for my stack" cure
> > >everyones OOM blues? I propose that that's a fair use for swap nowadays.
> >
> > I don't know; what happens now if you use more than 8 MB of stack? Do "bad
> > things" happen, or does the kernel grow the stack?
>
> I don't believe you can grow beyond your rlimit.
>
> I also think that you start off with less stack than that and libc
> or stuff embedded in your code by gcc makes sbrk() calls to grow the
> stack up to your rlimit as necessary.

Not at all. The stack is managed by the kernel and grown as
necessary. The stack is in no way associated with the data heap and
neither libc nor gcc care about stack usage. The stack is simply
there (and will grow as needed) and cannot be managed by the program.

You could use your own allocated stack in the data heap though, that's
what multithreaded programs have to do since a stack can't be shared.

-- 
          Andreas E. Bombe <andreas.bombe@munich.netsurf.de>
http://home.pages.de/~andreas.bombe/                DSA key 0x04880A44

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