Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix manythreads test case on s390
@ 2004-04-23 16:33 Ulrich Weigand
  2004-04-23 18:18 ` Daniel Jacobowitz
  2004-04-24  0:03 ` Andrew Cagney
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Weigand @ 2004-04-23 16:33 UTC (permalink / raw)
  To: gdb-patches

Hello,

the new manythreads.c test case fails on s390 when using NPTL,
because it tries to create 256 threads with default thread stack
size (which happens to be 8MB for NPTL).  This is hard to do
when the total address space size is 2 GB...

This can be fixed by using pthread_addr_setstacksize to reduce
the thread stack size.

Bye,
Ulrich

ChangeLog:

	* gdb.threads/manythreads.c: Reduce thread stack size.

Index: gdb/testsuite/gdb.threads/manythreads.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/manythreads.c,v
retrieving revision 1.1
diff -c -p -r1.1 manythreads.c
*** gdb/testsuite/gdb.threads/manythreads.c	22 Apr 2004 22:19:40 -0000	1.1
--- gdb/testsuite/gdb.threads/manythreads.c	23 Apr 2004 16:15:20 -0000
*************** main (int argc, char **argv)
*** 19,24 ****
--- 19,25 ----
    int i, j;
  
    pthread_attr_init (&attr);
+   pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
  
    /* Create a ton of quick-executing threads, then wait for them to
       complete.  */
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix manythreads test case on s390
  2004-04-23 16:33 [PATCH] Fix manythreads test case on s390 Ulrich Weigand
@ 2004-04-23 18:18 ` Daniel Jacobowitz
  2004-04-23 19:25   ` Ulrich Weigand
  2004-04-24  0:03 ` Andrew Cagney
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-04-23 18:18 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Fri, Apr 23, 2004 at 06:33:48PM +0200, Ulrich Weigand wrote:
> Hello,
> 
> the new manythreads.c test case fails on s390 when using NPTL,
> because it tries to create 256 threads with default thread stack
> size (which happens to be 8MB for NPTL).  This is hard to do
> when the total address space size is 2 GB...
> 
> This can be fixed by using pthread_addr_setstacksize to reduce
> the thread stack size.

None of the threads run to completion in time to reuse their stack
space?  I'm surprised by that (though it's certainly a valid outcome,
it's unlike how NPTL behaves elsewhere).

Anyway, I've no objection to the patch.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix manythreads test case on s390
  2004-04-24  0:03 ` Andrew Cagney
@ 2004-04-23 19:04   ` Jeff Johnston
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Johnston @ 2004-04-23 19:04 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Ulrich Weigand, gdb-patches

Andrew Cagney wrote:
>> Hello,
>>
>> the new manythreads.c test case fails on s390 when using NPTL,
>> because it tries to create 256 threads with default thread stack
>> size (which happens to be 8MB for NPTL).  This is hard to do
>> when the total address space size is 2 GB...
>>
>> This can be fixed by using pthread_addr_setstacksize to reduce
>> the thread stack size.
> 
> 
> Outch, the fix is "obvious".  Jeff, what to check this in along with the 
> (C) fix?
> 

Both changes checked in.

-- Jeff J.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix manythreads test case on s390
  2004-04-23 18:18 ` Daniel Jacobowitz
@ 2004-04-23 19:25   ` Ulrich Weigand
  0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2004-04-23 19:25 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Ulrich Weigand, gdb-patches

Daniel Jacobowitz wrote:

> None of the threads run to completion in time to reuse their stack
> space?  I'm surprised by that (though it's certainly a valid outcome,
> it's unlike how NPTL behaves elsewhere).

On my system the 127th pthread_create reproducibly fails, which
is consistent with no thread stack being reused early.

Maybe it's an SMP effect (one CPU is quickly running all the 
pthread_create's, while the others are executing the thread
functions, which may be slow due to printf ...)?

On the other hand, it may also be the case that running in a
virtualized environment exaggerates race windows; we've seen
plenty of examples for this.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix manythreads test case on s390
  2004-04-23 16:33 [PATCH] Fix manythreads test case on s390 Ulrich Weigand
  2004-04-23 18:18 ` Daniel Jacobowitz
@ 2004-04-24  0:03 ` Andrew Cagney
  2004-04-23 19:04   ` Jeff Johnston
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-04-24  0:03 UTC (permalink / raw)
  To: Ulrich Weigand, J. Johnston; +Cc: gdb-patches

> Hello,
> 
> the new manythreads.c test case fails on s390 when using NPTL,
> because it tries to create 256 threads with default thread stack
> size (which happens to be 8MB for NPTL).  This is hard to do
> when the total address space size is 2 GB...
> 
> This can be fixed by using pthread_addr_setstacksize to reduce
> the thread stack size.

Outch, the fix is "obvious".  Jeff, what to check this in along with the 
(C) fix?

Andrew

> Bye,
> Ulrich
> 
> ChangeLog:



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-24  0:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 16:33 [PATCH] Fix manythreads test case on s390 Ulrich Weigand
2004-04-23 18:18 ` Daniel Jacobowitz
2004-04-23 19:25   ` Ulrich Weigand
2004-04-24  0:03 ` Andrew Cagney
2004-04-23 19:04   ` Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox