Skip to content

Commit

Permalink
Fix nptl/tst-cond1{6,7,8}.c on 32-bit with many cpus.
Browse files Browse the repository at this point in the history
	* tst-cond16.c (do_test): Use a thread stack size which is either
	PTHREAD_STACK_MIN or the page size, whichever is larger.
	* tst-cond18.c (do_test): Likewise.
  • Loading branch information
David S. Miller committed Mar 27, 2012
1 parent 6143dc8 commit 7ac88e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2012-03-27 David S. Miller <davem@davemloft.net>

* tst-cond16.c (do_test): Use a thread stack size which is either
PTHREAD_STACK_MIN or the page size, whichever is larger.
* tst-cond18.c (do_test): Likewise.

2012-03-19 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/pthreaddef.h (CURRENT_STACK_FRAME): Use
Expand Down
10 changes: 8 additions & 2 deletions nptl/tst-cond16.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ do_test (void)
count *= 4;

pthread_t th[count];
int i, ret;
pthread_attr_t attr;
int i, ret, sz;
pthread_attr_init (&attr);
sz = __getpagesize ();
if (sz < PTHREAD_STACK_MIN)
sz = PTHREAD_STACK_MIN;
pthread_attr_setstacksize (&attr, sz);
for (i = 0; i < count; ++i)
if ((ret = pthread_create (&th[i], NULL, tf, NULL)) != 0)
if ((ret = pthread_create (&th[i], &attr, tf, NULL)) != 0)
{
errno = ret;
printf ("pthread_create %d failed: %m\n", i);
Expand Down
10 changes: 8 additions & 2 deletions nptl/tst-cond18.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,16 @@ do_test (void)
count *= 8;

pthread_t th[count + 1];
int i, ret;
pthread_attr_t attr;
int i, ret, sz;
pthread_attr_init (&attr);
sz = __getpagesize ();
if (sz < PTHREAD_STACK_MIN)
sz = PTHREAD_STACK_MIN;
pthread_attr_setstacksize (&attr, sz);

for (i = 0; i <= count; ++i)
if ((ret = pthread_create (&th[i], NULL, tf, (void *) (long) i)) != 0)
if ((ret = pthread_create (&th[i], &attr, tf, (void *) (long) i)) != 0)
{
errno = ret;
printf ("pthread_create %d failed: %m\n", i);
Expand Down

0 comments on commit 7ac88e3

Please sign in to comment.