From c303df56d32faa47ef163726357ed3ee5d075b88 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Thu, 2 Nov 2023 11:48:25 -0400 Subject: 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 --- libpthread/nptl/sysdeps/xtensa/pthreaddef.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'libpthread/nptl/sysdeps/xtensa') 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 .  */ -/* Default stack size. */ -#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) - /* Required stack pointer alignment at beginning. */ #define STACK_ALIGN 16 -- cgit v1.2.3