This problem was raised for the IBM Java-1.4.1 SDK but applies to any program using nptl where the system page size is larger then PTHREAD_STACK_MIN. This can happen on powerpc starting with the POWER5+ systems whihc support 64K pages in hardware. It does not fail on linuxthreads. In this case the pthread_create fails because the default value of pthread_attr for stack_size was set from PTHREAD_STACK_MIN which is a compile time constant. In this case it was much smaller then the actual page size. The other problem is that the test in allocatestack.c that verifies the minimum allocation for stack space includes the guard page plus 2 additonal pages. This is ok where the pagesize is less then the PTHREAD_STACK_MIN but gets rediculous with large pages sizes.
This topic has been discussed on libc-hackers: http://sources.redhat.com/ml/libc-hacker/2005-09/msg00030.html http://sources.redhat.com/ml/libc-hacker/2005-10/msg00001.html http://sources.redhat.com/ml/libc-hacker/2005-10/msg00016.html http://sources.redhat.com/ml/libc-hacker/2005-10/msg00020.html http://sources.redhat.com/ml/libc-hacker/2005-10/msg00028.html http://sources.redhat.com/ml/libc-hacker/2005-11/msg00000.html I provided a proposed fix in: http://sources.redhat.com/ml/libc-hacker/2005-12/msg00001.html
Created attachment 800 [details] Large page test case for pthread_create This is a version of the existing test that adds explicit tests for the pthread_attr_setstacksize = PTHREAD_STACK_MIN and (2 * sysconf(_SC_PAGESIZE) cases.
What could be fixed is fixed. The rest is a problem of the ABI. The minimum stack size should have been selected more carefully. There is nothing which can be done. If the stack is too small, it is too small.