Dealing with multiple page sizes in NPTL
Steve Munroe
sjmunroe@us.ibm.com
Thu Oct 27 18:29:00 GMT 2005
Uli would you take a look at the minimum stack size test in
nptl/allocatestack.c (allocate_stack):
/* Make sure the size of the stack is enough for the guard and
eventually the thread descriptor. */
guardsize = (attr->guardsize + pagesize_m1) & ~pagesize_m1;
if (__builtin_expect (size < (guardsize + __static_tls_size
+ MINIMAL_REST_STACK + pagesize_m1 +
1),
0))
/* The stack is too small (or the guard too large). */
return EINVAL;
I don't think this test is correct and it causes pthread_create failures
with the alternate 64KB page support in powerpc. It seems odd that this
code rounds the gaurdpage but simply adds s full page to the thread stack
without rounding. As is this code forces a 3 page minimum even when that
page size is larger then PTHREAD_STACK_MIN. I suggest that something like.
if (__builtin_expect (size < ((guardsize + __static_tls_size
+ MINIMAL_REST_STACK + pagesize_m1) &
~pagesize_m1),
0))
Which should continue to work for existing systems and still enforces the
2 page minimum for larger page sizes (pagesize > PTHREAD_STACK_MIN).
Thanks.
Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center
More information about the Libc-hacker
mailing list