aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-09-25 15:15:45 -0700
committerBrian Behlendorf <[email protected]>2014-09-30 10:46:55 -0700
commitaa0ac7caa438bf3981456c559d4224be104ccc7d (patch)
treef3ddd427d47ad3d28535be3067bbdc4c9f239970 /include
parentcb08f063074a5363810a39775fd90a4d214c5d87 (diff)
Make user stack limit configurable
To aid in detecting and debugging stack overflow issues make the user space stack limit configurable via a new ZFS_STACK_SIZE environment variable. The value assigned to ZFS_STACK_SIZE will be used as the default stack size in bytes. Because this is mainly useful as a debugging aid in conjunction with ztest the stack limit is disabled by default. See the ztest(1) man page for additional details on using the ZFS_STACK_SIZE environment variable. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Closes #2743 Issue #2293
Diffstat (limited to 'include')
-rw-r--r--include/sys/zfs_context.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index bbb8a0463..f26c827dc 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -203,16 +203,17 @@ extern void vpanic(const char *, va_list);
#else
#define SET_ERROR(err) (err)
#endif
+
/*
- * Threads
+ * Threads. TS_STACK_MIN is dictated by the minimum allowed pthread stack
+ * size. While TS_STACK_MAX is somewhat arbitrary, it was selected to be
+ * large enough for the expected stack depth while small enough to avoid
+ * exhausting address space with high thread counts.
*/
#define TS_MAGIC 0x72f158ab4261e538ull
#define TS_RUN 0x00000002
-#ifdef __linux__
-#define STACK_SIZE 8192 /* Linux x86 and amd64 */
-#else
-#define STACK_SIZE 24576 /* Solaris */
-#endif
+#define TS_STACK_MIN PTHREAD_STACK_MIN
+#define TS_STACK_MAX (256 * 1024)
/* in libzpool, p0 exists only to have its address taken */
typedef struct proc {