From owner-freebsd-threads@FreeBSD.ORG Fri Jan 21 07:46:57 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5743616A4CE for ; Fri, 21 Jan 2005 07:46:57 +0000 (GMT) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [24.172.16.118]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5B2C43D53 for ; Fri, 21 Jan 2005 07:46:56 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from shumai.marcuscom.com (shumai.marcuscom.com [192.168.1.4]) j0L7l2JE043550 for ; Fri, 21 Jan 2005 02:47:02 -0500 (EST) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: threads@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-1U1q414SiXPHFJkb9jxF" Organization: FreeBSD, Inc. Date: Fri, 21 Jan 2005 02:46:46 -0500 Message-Id: <1106293606.11662.20.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Subject: [PATCH] Dynamic thread stack size X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2005 07:46:57 -0000 --=-1U1q414SiXPHFJkb9jxF Content-Type: text/plain Content-Transfer-Encoding: quoted-printable In a follow-up to the previous discussion on increasing our default thread stacksize, I thought I'd look at how some other BSD implementations do it. Mezz mentioned that he thought NetBSD had a 2 MB default stacksize, so I took a look. What I found was that NetBSD doesn't have a static default stacksize. Instead, they use the stacksize rlimit and a PTHREAD_STACKSIZE environment variable to get both the initial stacksize as well as each thread's default stacksize. I thought this would be a really good way of doing things, so I ported their work to FreeBSD. Here is a patch against 5-STABLE's libpthread (also applies to HEAD) that adds a dynamic thread stacksize. This can be disabled at compile time by uncommenting the -DTHR_FIXEDSTACKSIZE CFLAG in the Makefile. Initial testing shows this does the trick with applications such as gstreamer and Evolution that require a larger initial thread stacksize and per-thread default stacksize respectively. What do you think? http://www.marcuscom.com/downloads/libpthread.diff Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-1U1q414SiXPHFJkb9jxF Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQBB8LNmb2iPiv4Uz4cRApkUAJsEw93zcpMdU9Jud0B0TypCjdWB+QCfQvZD FEj/u6GC+UibcQz8Q9wQdIQ= =il8/ -----END PGP SIGNATURE----- --=-1U1q414SiXPHFJkb9jxF--