summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps
diff options
context:
space:
mode:
authorBen Wolsieffer <ben.wolsieffer@hefring.com>2023-11-02 11:48:25 -0400
committerWaldemar Brodkorb <wbx@openadk.org>2023-11-09 16:48:33 +0100
commitc303df56d32faa47ef163726357ed3ee5d075b88 (patch)
treed00ee1101dd14b5c1bfbd712765a26d56b777845 /libpthread/nptl/sysdeps
parent8166707a3350ce1fdaf669fb3836810727379342 (diff)
libpthread/nptl: make default stack size configurable
Threads currently have 2-4 MiB stacks by default (depending on the platform). This is fine on MMU platforms, where this stack space is not actually allocated until it is used, but tends to waste a large amount of memory on no-MMU platforms. This patch adds a PTHREADS_STACK_DEFAULT_SIZE Kconfig option that allows the user to override the default stack size at build time. This allows the user to select a reasonable default stack size for the software that runs on their system, and avoids the need to patch every package to add calls to pthread_attr_setstacksize(). An alternative to this patch would be to change the hardcoded default stack size on no-MMU platforms, but it is difficult to choose an appropriate value because the minimum required stack depends on the software in use. This would also be a breaking change. Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Diffstat (limited to 'libpthread/nptl/sysdeps')
-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
20 files changed, 0 insertions, 60 deletions
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