Date: Sat, 23 Jan 2016 00:58:59 -0800 From: Maxim Sobolev <sobomax@sippysoft.com> To: David Chisnall <theraven@freebsd.org> Cc: Ed Maste <emaste@freebsd.org>, =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= <roger.pau@citrix.com>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: Too low PTHREAD_STACK_MIN value? Message-ID: <CAH7qZfu2bFKePJY4oHkwPH=u8pVfEoGHmZzg3=f_V1NKf0hDZQ@mail.gmail.com> In-Reply-To: <E2C880CC-10A1-40A0-8489-68C6A8DF27F9@FreeBSD.org> References: <531F42CD.8020307@citrix.com> <913B1E7A-5192-430F-ABAF-576DFCFF98E6@FreeBSD.org> <CAPyFy2BK6R90pop9v_%2BtW54cv3BoHCQkxBu4-E2fnZ1BptsfHw@mail.gmail.com> <E2C880CC-10A1-40A0-8489-68C6A8DF27F9@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
For what it's worth, I agree with David. This looks like definite misuse of the constant. If app X requires min size of stack of Y, it's fullish of it if to expect our PTHREAD_STACK_MIN somehow accommodate that. It should be really using MAX(PTHREAD_STACK_MIN, Y) to set its stack instead. Should be easy to patch and it needs to be reported to the upstream vendor(s) instead. Don't forget that bumping this limit, no matter how small, will get multiplied by the number of threads running, which could be in many thousands. On Fri, Jan 22, 2016 at 4:09 AM, David Chisnall <theraven@freebsd.org> wrote: > On 21 Jan 2016, at 16:02, Ed Maste <emaste@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=E2=80=99t 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 harmf= ul > as it means that people using it correctly will be using a lot more memor= y > per thread. > > David > > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= " > --=20 Maksym Sobolyev Sippy Software, Inc. Internet Telephony (VoIP) Experts Tel (Canada): +1-778-783-0474 Tel (Toll-Free): +1-855-747-7779 Fax: +1-866-857-6942 Web: http://www.sippysoft.com MSN: sales@sippysoft.com Skype: SippySoft
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfu2bFKePJY4oHkwPH=u8pVfEoGHmZzg3=f_V1NKf0hDZQ>