|
|
12745e |
diff -pruN glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile
|
|
|
29e444 |
--- glibc-2.17-c758a686/nptl/Makefile 2013-07-31 11:51:24.882747234 +0530
|
|
|
12745e |
+++ glibc-2.17-c758a686/nptl/Makefile 2013-07-31 11:58:55.964731526 +0530
|
|
|
29e444 |
@@ -276,10 +276,7 @@ gen-as-const-headers = pthread-errnos.sy
|
|
|
29e444 |
|
|
|
29e444 |
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
|
|
|
29e444 |
|
|
|
29e444 |
-# The size is 1MB + 4KB. The extra 4KB has been added to prevent allocatestack
|
|
|
29e444 |
-# from resizing the input size to avoid the 64K aliasing conflict on Intel
|
|
|
29e444 |
-# processors.
|
|
|
29e444 |
-DEFAULT_STACKSIZE=1052672
|
|
|
29e444 |
+DEFAULT_STACKSIZE=1048576
|
|
|
29e444 |
CFLAGS-tst-default-attr.c = -DDEFAULT_STACKSIZE=$(DEFAULT_STACKSIZE)
|
|
|
29e444 |
tst-default-attr-ENV = GLIBC_PTHREAD_STACKSIZE=$(DEFAULT_STACKSIZE)
|
|
|
29e444 |
|
|
|
12745e |
diff -pruN glibc-2.17-c758a686/nptl/tst-default-attr.c glibc-2.17-c758a686/nptl/tst-default-attr.c
|
|
|
29e444 |
--- glibc-2.17-c758a686/nptl/tst-default-attr.c 2013-07-31 11:51:24.885747234 +0530
|
|
|
12745e |
+++ glibc-2.17-c758a686/nptl/tst-default-attr.c 2013-07-31 12:18:10.016691337 +0530
|
|
|
29e444 |
@@ -38,6 +38,7 @@
|
|
|
29e444 |
|
|
|
29e444 |
/* DEFAULT_STACKSIZE macro is defined in the Makefile. */
|
|
|
29e444 |
static size_t stacksize = DEFAULT_STACKSIZE;
|
|
|
29e444 |
+long int pagesize;
|
|
|
29e444 |
|
|
|
29e444 |
static int
|
|
|
29e444 |
verify_stacksize_result (pthread_attr_t *attr)
|
|
|
29e444 |
@@ -46,12 +47,20 @@ verify_stacksize_result (pthread_attr_t
|
|
|
29e444 |
|
|
|
29e444 |
RETURN_IF_FAIL (pthread_attr_getstacksize, attr, &stack);
|
|
|
29e444 |
|
|
|
29e444 |
- if (stacksize != stack)
|
|
|
29e444 |
+ /* pthread_create perturbs the stack size by a page if it aligns to 64K to
|
|
|
29e444 |
+ avoid the 64K aliasing conflict. We cannot simply add 4K to the size in
|
|
|
29e444 |
+ the Makefile because it breaks the test on powerpc since the page size
|
|
|
29e444 |
+ there is 64K, resulting in a resize in __pthread_initialize_minimal.
|
|
|
29e444 |
+ Hence, our check is to ensure that the stack size is not more than a page
|
|
|
29e444 |
+ more than the requested size. */
|
|
|
29e444 |
+ if (stack < stacksize || stack > stacksize + pagesize)
|
|
|
29e444 |
{
|
|
|
29e444 |
printf ("failed to set default stacksize (%zu, %zu)\n", stacksize, stack);
|
|
|
29e444 |
return 1;
|
|
|
29e444 |
}
|
|
|
29e444 |
|
|
|
29e444 |
+ printf ("Requested %zu and got %zu\n", stacksize, stack);
|
|
|
29e444 |
+
|
|
|
29e444 |
return 0;
|
|
|
29e444 |
}
|
|
|
29e444 |
|
|
|
29e444 |
@@ -101,6 +110,15 @@ run_threads (void)
|
|
|
29e444 |
static int
|
|
|
29e444 |
do_test (void)
|
|
|
29e444 |
{
|
|
|
29e444 |
+ pthread_attr_t attr;
|
|
|
29e444 |
+
|
|
|
29e444 |
+ pagesize = sysconf (_SC_PAGESIZE);
|
|
|
29e444 |
+ if (pagesize < 0)
|
|
|
29e444 |
+ {
|
|
|
29e444 |
+ printf ("sysconf failed: %s\n", strerror (errno));
|
|
|
29e444 |
+ return 1;
|
|
|
29e444 |
+ }
|
|
|
29e444 |
+
|
|
|
29e444 |
RETURN_IF_FAIL (run_threads);
|
|
|
29e444 |
return 0;
|
|
|
29e444 |
}
|