summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/Configs/Config.in9
-rw-r--r--libpthread/nptl/init.c14
-rw-r--r--libpthread/nptl/sysdeps/aarch64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/alpha/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/arc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/arm/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/csky/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/i386/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/kvx/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/m68k/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/metag/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/microblaze/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/mips/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/nds32/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/nios2/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/or1k/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/powerpc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/riscv64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/sh/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/sparc/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/x86_64/pthreaddef.h3
-rw-r--r--libpthread/nptl/sysdeps/xtensa/pthreaddef.h3
22 files changed, 16 insertions, 67 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 49f561e5e..287db13d2 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -644,6 +644,15 @@ config PTHREADS_DEBUG_SUPPORT
If you are doing development and want to debug applications using
uClibc's pthread library, answer Y. Otherwise, answer N.
+config PTHREADS_STACK_DEFAULT_SIZE
+ int "Default thread stack size"
+ default 4194304 if TARGET_alpha # 4 MiB
+ default 4194304 if TARGET_powerpc # 4 MiB
+ default 2097152 # 2 MiB
+ help
+ Set the default thread stack size. This option is useful on MMU-less
+ systems where the stack size is fixed and the default stack size may
+ be excessively large and waste memory.
config UCLIBC_HAS_SYSLOG
bool "Syslog support"
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 5d25ded7d..ddc552f2e 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -278,17 +278,17 @@ __pthread_initialize_minimal_internal (void)
struct rlimit limit;
if (getrlimit (RLIMIT_STACK, &limit) != 0
|| limit.rlim_cur == RLIM_INFINITY)
- /* The system limit is not usable. Use an architecture-specific
- default. */
- limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
- else if (limit.rlim_cur < PTHREAD_STACK_MIN)
+ /* The system limit is not usable. Use a user-specified or
+ architecture-specific default. */
+ limit.rlim_cur = __PTHREADS_STACK_DEFAULT_SIZE__;
+ if (limit.rlim_cur < PTHREAD_STACK_MIN)
/* The system limit is unusably small.
Use the minimal size acceptable. */
limit.rlim_cur = PTHREAD_STACK_MIN;
- /* Do not exceed architecture specific default */
- if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
- limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
+ /* Do not exceed the user-specified or architecture-specific default */
+ if (limit.rlim_cur > __PTHREADS_STACK_DEFAULT_SIZE__)
+ limit.rlim_cur = __PTHREADS_STACK_DEFAULT_SIZE__;
/* Make sure it meets the minimum size that allocate_stack
(allocatestack.c) will demand, which depends on the page size. */
diff --git a/libpthread/nptl/sysdeps/aarch64/pthreaddef.h b/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
index d9495f9cb..7172f406b 100644
--- a/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/aarch64/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/alpha/pthreaddef.h b/libpthread/nptl/sysdeps/alpha/pthreaddef.h
index 72a311c33..6b99f3b4f 100644
--- a/libpthread/nptl/sysdeps/alpha/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/alpha/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. The ABI requires 16. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/arc/pthreaddef.h b/libpthread/nptl/sysdeps/arc/pthreaddef.h
index bf4f0f29a..0fb28dc48 100644
--- a/libpthread/nptl/sysdeps/arc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/arc/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/arm/pthreaddef.h b/libpthread/nptl/sysdeps/arm/pthreaddef.h
index a05ac879d..f790a6dca 100644
--- a/libpthread/nptl/sysdeps/arm/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/arm/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/csky/pthreaddef.h b/libpthread/nptl/sysdeps/csky/pthreaddef.h
index 992fced01..4aa97ee27 100644
--- a/libpthread/nptl/sysdeps/csky/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/csky/pthreaddef.h
@@ -5,9 +5,6 @@
* in this tarball.
*/
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/i386/pthreaddef.h b/libpthread/nptl/sysdeps/i386/pthreaddef.h
index a0659039d..2fd27113c 100644
--- a/libpthread/nptl/sysdeps/i386/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/i386/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/kvx/pthreaddef.h b/libpthread/nptl/sysdeps/kvx/pthreaddef.h
index 6e1485998..03945bc5f 100644
--- a/libpthread/nptl/sysdeps/kvx/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/kvx/pthreaddef.h
@@ -6,9 +6,6 @@
* Copyright (C) 2019 Kalray Inc.
*/
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 32
diff --git a/libpthread/nptl/sysdeps/m68k/pthreaddef.h b/libpthread/nptl/sysdeps/m68k/pthreaddef.h
index 1651b3d5f..04d565191 100644
--- a/libpthread/nptl/sysdeps/m68k/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/m68k/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/metag/pthreaddef.h b/libpthread/nptl/sysdeps/metag/pthreaddef.h
index bf4f0f29a..0fb28dc48 100644
--- a/libpthread/nptl/sysdeps/metag/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/metag/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/microblaze/pthreaddef.h b/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
index 47e87dd71..a01b59fab 100644
--- a/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/microblaze/pthreaddef.h
@@ -19,9 +19,6 @@
#include <stdlib.h>
#include <string.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/mips/pthreaddef.h b/libpthread/nptl/sysdeps/mips/pthreaddef.h
index 692988205..adedd7715 100644
--- a/libpthread/nptl/sysdeps/mips/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/mips/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/nds32/pthreaddef.h b/libpthread/nptl/sysdeps/nds32/pthreaddef.h
index c9d3f7781..0dca16c34 100644
--- a/libpthread/nptl/sysdeps/nds32/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/nds32/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/nios2/pthreaddef.h b/libpthread/nptl/sysdeps/nios2/pthreaddef.h
index 4268252dd..5be435237 100644
--- a/libpthread/nptl/sysdeps/nios2/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/nios2/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 4
diff --git a/libpthread/nptl/sysdeps/or1k/pthreaddef.h b/libpthread/nptl/sysdeps/or1k/pthreaddef.h
index e8da3d965..394962172 100644
--- a/libpthread/nptl/sysdeps/or1k/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/or1k/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/powerpc/pthreaddef.h b/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
index 36bf76404..a46c094b6 100644
--- a/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/powerpc/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. The ABI requires 16
bytes (for both 32-bit and 64-bit PowerPC). */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/riscv64/pthreaddef.h b/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
index fbd40a74f..5a929bc77 100644
--- a/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/riscv64/pthreaddef.h
@@ -14,9 +14,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/sh/pthreaddef.h b/libpthread/nptl/sysdeps/sh/pthreaddef.h
index fc3ae6029..918aaf54f 100644
--- a/libpthread/nptl/sysdeps/sh/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/sh/pthreaddef.h
@@ -17,9 +17,6 @@
#include <sysdep.h>
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 8
diff --git a/libpthread/nptl/sysdeps/sparc/pthreaddef.h b/libpthread/nptl/sysdeps/sparc/pthreaddef.h
index 435fedcf3..65f6655a4 100644
--- a/libpthread/nptl/sysdeps/sparc/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/sparc/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/x86_64/pthreaddef.h b/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
index 2b2285285..98ab8cfb1 100644
--- a/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/x86_64/pthreaddef.h
@@ -16,9 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. SSE requires 16
bytes. */
#define STACK_ALIGN 16
diff --git a/libpthread/nptl/sysdeps/xtensa/pthreaddef.h b/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
index 34c1851c3..13d8fef4c 100644
--- a/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
+++ b/libpthread/nptl/sysdeps/xtensa/pthreaddef.h
@@ -15,9 +15,6 @@
License along with the GNU C Library; see the file COPYING.LIB. If
not, see <http://www.gnu.org/licenses/>.  */
-/* Default stack size. */
-#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
-
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16