From owner-freebsd-current@freebsd.org Fri Jan 22 12:10:01 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23A6A8B1A5 for ; Fri, 22 Jan 2016 12:10:01 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7557110BF; Fri, 22 Jan 2016 12:10:01 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.0.7] (cpc91230-cmbg18-2-0-cust661.5-4.cable.virginm.net [82.1.230.150]) (authenticated bits=0) by theravensnest.org (8.15.2/8.15.2) with ESMTPSA id u0MC9kXA061290 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Jan 2016 12:09:48 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc91230-cmbg18-2-0-cust661.5-4.cable.virginm.net [82.1.230.150] claimed to be [192.168.0.7] Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: Too low PTHREAD_STACK_MIN value? From: David Chisnall In-Reply-To: Date: Fri, 22 Jan 2016 12:09:40 +0000 Cc: =?utf-8?Q?Roger_Pau_Monn=C3=A9?= , FreeBSD Current Content-Transfer-Encoding: quoted-printable Message-Id: References: <531F42CD.8020307@citrix.com> <913B1E7A-5192-430F-ABAF-576DFCFF98E6@FreeBSD.org> To: Ed Maste X-Mailer: Apple Mail (2.2104) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2016 12:10:01 -0000 On 21 Jan 2016, at 16:02, Ed Maste wrote: >=20 > 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. >=20 > 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 harmful as it means that people using it correctly = will be using a lot more memory per thread. David