Re: Too low PTHREAD_STACK_MIN value?

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Fri, 22 Jan 2016 12:09:40 +0000
On 21 Jan 2016, at 16:02, Ed Maste <emaste_at_freebsd.org> wrote:
> 
> I found that lang/polyml uses PTHREAD_STACK_MIN for a trivial signal
> handler thread it creates[1]. They found it was too small and
> implemented a 4K minimum bound to fix polyml on FreeBSD[2]. Even if
> this isn't really the intended use of PTHREAD_STACK_MIN it suggests
> the 2K x86 minimum may indeed be too low.
> 
> I ran into this while trying LLVM's libunwind, which requires more
> stack space. 2K is certainly too low with LLVM libunwind. Is it
> reasonable to just increase it to say 8K?

I don’t really like this solution.  PTHREAD_STACK_MIN is the size for a stack that does not do anything.  You should never use it without adding the amount that you are going to need (which might be nothing if you are running code from a language that does not use a conventional C-style stack, but still wants to use OS threads).  Making it larger because a specific kind of thing that some consumers want to do with it needs more space is definitely against the spirit of the value and potentially harmful as it means that people using it correctly will be using a lot more memory per thread.

David
Received on Fri Jan 22 2016 - 11:10:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:02 UTC