* [PATCH] stdlib: Fixing test-*atexit*-race tests on ia64
@ 2018-02-01 12:41 Adhemerval Zanella
2018-02-01 13:05 ` Dmitry V. Levin
0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2018-02-01 12:41 UTC (permalink / raw)
To: libc-alpha
The tests requires a new thread stack size to a value (0x20000) lower than
architecture minimum (0x3000). Set PTHREAD_STACK_MIN in this case.
Checked on ia64-linux-gnu.
* stdlib/test-atexit-race-common.c (do_test): Check stack size
against PTHREAD_STACK_MIN.
---
ChangeLog | 5 +++++
stdlib/test-atexit-race-common.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/stdlib/test-atexit-race-common.c b/stdlib/test-atexit-race-common.c
index 4d7f911..02d459c 100644
--- a/stdlib/test-atexit-race-common.c
+++ b/stdlib/test-atexit-race-common.c
@@ -34,9 +34,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <support/xthread.h>
+#include <sys/param.h>
const size_t kNumThreads = 1024;
const size_t kNumHandlers = 1024;
+const size_t kStacksize = 0x20000;
static void *
threadfunc (void *unused)
@@ -60,7 +62,8 @@ do_test (void)
/* With default 8MiB Linux stack size, creating 1024 threads can cause
VM exhausiton on 32-bit machines. Reduce stack size of each thread to
128KiB for a maximum required VM size of 128MiB. */
- xpthread_attr_setstacksize (&attr, 128 * 1024);
+ size_t ss = kStacksize < PTHREAD_STACK_MIN ? PTHREAD_STACK_MIN : kStacksize;
+ xpthread_attr_setstacksize (&attr, ss);
for (i = 0; i < kNumThreads; ++i) {
xpthread_create (&attr, threadfunc, NULL);
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] stdlib: Fixing test-*atexit*-race tests on ia64
2018-02-01 12:41 [PATCH] stdlib: Fixing test-*atexit*-race tests on ia64 Adhemerval Zanella
@ 2018-02-01 13:05 ` Dmitry V. Levin
2018-02-01 13:14 ` Adhemerval Zanella
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2018-02-01 13:05 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]
On Thu, Feb 01, 2018 at 10:41:05AM -0200, Adhemerval Zanella wrote:
> The tests requires a new thread stack size to a value (0x20000) lower than
> architecture minimum (0x3000). Set PTHREAD_STACK_MIN in this case.
These tests require a new thread stack size set to a value (0x20000)
lower than the architecture minimum (0x30000). Set the stack size
to PTHREAD_STACK_MIN in this case.
> Checked on ia64-linux-gnu.
>
> * stdlib/test-atexit-race-common.c (do_test): Check stack size
> against PTHREAD_STACK_MIN.
> ---
> ChangeLog | 5 +++++
> stdlib/test-atexit-race-common.c | 5 ++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/stdlib/test-atexit-race-common.c b/stdlib/test-atexit-race-common.c
> index 4d7f911..02d459c 100644
> --- a/stdlib/test-atexit-race-common.c
> +++ b/stdlib/test-atexit-race-common.c
> @@ -34,9 +34,11 @@
> #include <stdio.h>
> #include <stdlib.h>
> #include <support/xthread.h>
> +#include <sys/param.h>
#include <limits.h>
> const size_t kNumThreads = 1024;
> const size_t kNumHandlers = 1024;
> +const size_t kStacksize = 0x20000;
const size_t kStacksize =
0x20000 < PTHREAD_STACK_MIN ? PTHREAD_STACK_MIN : 0x20000;
> static void *
> threadfunc (void *unused)
> @@ -60,7 +62,8 @@ do_test (void)
> /* With default 8MiB Linux stack size, creating 1024 threads can cause
> VM exhausiton on 32-bit machines. Reduce stack size of each thread to
> 128KiB for a maximum required VM size of 128MiB. */
> - xpthread_attr_setstacksize (&attr, 128 * 1024);
> + size_t ss = kStacksize < PTHREAD_STACK_MIN ? PTHREAD_STACK_MIN : kStacksize;
> + xpthread_attr_setstacksize (&attr, ss);
>
> for (i = 0; i < kNumThreads; ++i) {
> xpthread_create (&attr, threadfunc, NULL);
... and this hunk won't be needed at all.
--
ldv
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] stdlib: Fixing test-*atexit*-race tests on ia64
2018-02-01 13:05 ` Dmitry V. Levin
@ 2018-02-01 13:14 ` Adhemerval Zanella
0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2018-02-01 13:14 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1.1: Type: text/plain, Size: 2137 bytes --]
On 01/02/2018 11:04, Dmitry V. Levin wrote:
> On Thu, Feb 01, 2018 at 10:41:05AM -0200, Adhemerval Zanella wrote:
>> The tests requires a new thread stack size to a value (0x20000) lower than
>> architecture minimum (0x3000). Set PTHREAD_STACK_MIN in this case.
>
> These tests require a new thread stack size set to a value (0x20000)
> lower than the architecture minimum (0x30000). Set the stack size
> to PTHREAD_STACK_MIN in this case.
>
>> Checked on ia64-linux-gnu.
>>
>> * stdlib/test-atexit-race-common.c (do_test): Check stack size
>> against PTHREAD_STACK_MIN.
>> ---
>> ChangeLog | 5 +++++
>> stdlib/test-atexit-race-common.c | 5 ++++-
>> 2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/stdlib/test-atexit-race-common.c b/stdlib/test-atexit-race-common.c
>> index 4d7f911..02d459c 100644
>> --- a/stdlib/test-atexit-race-common.c
>> +++ b/stdlib/test-atexit-race-common.c
>> @@ -34,9 +34,11 @@
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <support/xthread.h>
>> +#include <sys/param.h>
>
> #include <limits.h>
>
>> const size_t kNumThreads = 1024;
>> const size_t kNumHandlers = 1024;
>> +const size_t kStacksize = 0x20000;
>
> const size_t kStacksize =
> 0x20000 < PTHREAD_STACK_MIN ? PTHREAD_STACK_MIN : 0x20000;
Alright, I just set the logic to be near the comment, I do not have a strong
preference here.
>
>> static void *
>> threadfunc (void *unused)
>> @@ -60,7 +62,8 @@ do_test (void)
>> /* With default 8MiB Linux stack size, creating 1024 threads can cause
>> VM exhausiton on 32-bit machines. Reduce stack size of each thread to
>> 128KiB for a maximum required VM size of 128MiB. */
>> - xpthread_attr_setstacksize (&attr, 128 * 1024);
>> + size_t ss = kStacksize < PTHREAD_STACK_MIN ? PTHREAD_STACK_MIN : kStacksize;
>> + xpthread_attr_setstacksize (&attr, ss);
>>
>> for (i = 0; i < kNumThreads; ++i) {
>> xpthread_create (&attr, threadfunc, NULL);
>
> ... and this hunk won't be needed at all.
>
>
I will commit with your suggestions.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-01 13:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 12:41 [PATCH] stdlib: Fixing test-*atexit*-race tests on ia64 Adhemerval Zanella
2018-02-01 13:05 ` Dmitry V. Levin
2018-02-01 13:14 ` Adhemerval Zanella
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).