This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dealing with multiple page sizes in NPTL


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]