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 <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #2743
Issue #2293
This commit is contained in:
Brian Behlendorf
2014-09-25 15:15:45 -07:00
parent cb08f06307
commit aa0ac7caa4
3 changed files with 47 additions and 30 deletions
+7 -6
View File
@@ -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 {