This is the mail archive of the mailing list for the glibc project.

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: [PATCH] Fix nptl/tst-cond1{6,7} on 32-bit with many cpus

On 3/26/2012 5:34 PM, David Miller wrote:
> We still need to take __getpagesize() into account, because some
> PTHREAD_STACK_MIN definitions are smaller than the largest possible page
> size on the respective architecture. And it also turns out that
> tst-cond18 has the same problem as tst-cond16 and tst-cond17.

We have a similar (though simpler) fix for our system, where we have 64
cores and (on our older systems) only a 32-bit VA space.  We've been using
this patch, since 1MB stacks are clearly way bigger than any practical
need, but still total up to way smaller than the available VA space.

diff -r -u -N /ORIG/nptl/tst-cond18.c ./nptl/tst-cond18.c
--- /ORIG/nptl/tst-cond18.c     2010-05-04 07:27:23.000000000 -0400
+++ ./nptl/tst-cond18.c 2012-03-15 11:45:10.150606000 -0400
@@ -87,11 +87,15 @@
     count = 1;
   count *= 8;

+  pthread_attr_t attr;
+  pthread_attr_init (&attr);
+  pthread_attr_setstacksize (&attr, 1024 * 1024);
   pthread_t th[count + 1];
   int i, ret;

   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);

Chris Metcalf, Tilera Corp.

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