[ppc] Default stack size on ppc64

Steven Munroe munroesj at linux.vnet.ibm.comcom
Thu Mar 26 00:57:25 UTC 2015


On Wed, 2015-03-25 at 19:45 +0000, Richard W.M. Jones wrote:
> On Wed, Mar 25, 2015 at 06:30:25PM +0000, David Woodhouse wrote:
> > If the compiler is single-threaded, and increasing the stack ulimit 
> > fixes the problem, that implies that the default stack ulimit is less 
> > than the 8MiB-64KiB that it takes to reach the guard page...
> 
> Just so I'm clear, is the stack supposed to grow down automatically
> (ie. does the stack automatically use MAP_GROWSDOWN), or is OCaml
> supposed to do something when the stack hits the guard page?
> 
It depends on which code is allocating the stack.

The default GLIBC implementation under pthread_create will allocate it
as single anonymous mmap of 8MB then use mprotect on the lowest page to
mark the guard page no-access. As in:

3fff8ab40000-3fff8ab50000 ---p 00000000 00:00 0
3fff8ab50000-3fff8b340000 rw-p 00000000 00:00 [stack: 30348]
3fff8b340000-3fff8b350000 ---p 00000000 00:00 0
3fff8b350000-3fff8bb40000 rw-p 00000000 00:00 0
3fff8bb40000-3fff8bb50000 ---p 00000000 00:00 0
3fff8bb50000-3fff8c340000 rw-p 00000000 00:00 0
3fff8c340000-3fff8c350000 ---p 00000000 00:00 0
3fff8c350000-3fff8cb40000 rw-p 00000000 00:00 0

> I guess it's also possible that an OCaml stack frame is so big that it
> skips the guard page, or that GCC does some kind of stack "filling" to
> trigger the guard page which OCaml does not do.
> 
> Rich.
> 




More information about the ppc mailing list