public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Steve Munroe <sjmunroe@us.ibm.com>
To: Ulrich Drepper <drepper@redhat.com>, libc-hacker@sources.redhat.com
Cc: Roland McGrath <roland@redhat.com>
Subject: Re: Dealing with multiple page sizes in NPTL
Date: Thu, 27 Oct 2005 18:29:00 -0000	[thread overview]
Message-ID: <OFFC9A832D.96EE2FF0-ON862570A7.00637B02-862570A7.00659255@us.ibm.com> (raw)
In-Reply-To: <20051016125415.3F5561809AA@magilla.sf.frob.com>

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

  parent reply	other threads:[~2005-10-27 18:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 14:06 Steve Munroe
2005-10-16 12:54 ` Roland McGrath
2005-10-17 22:09   ` Steve Munroe
2005-11-03 15:33     ` Mark Brown
2005-10-27 18:29   ` Steve Munroe [this message]
2005-11-17 14:54   ` Steve Munroe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OFFC9A832D.96EE2FF0-ON862570A7.00637B02-862570A7.00659255@us.ibm.com \
    --to=sjmunroe@us.ibm.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).