From owner-freebsd-stable@FreeBSD.ORG Thu May 12 03:29:00 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B598316A4CE for ; Thu, 12 May 2005 03:29:00 +0000 (GMT) Received: from smtp819.mail.sc5.yahoo.com (smtp819.mail.sc5.yahoo.com [66.163.170.5]) by mx1.FreeBSD.org (Postfix) with SMTP id 0E1B743D76 for ; Thu, 12 May 2005 03:29:00 +0000 (GMT) (envelope-from noackjr@alumni.rice.edu) Received: from unknown (HELO optimator.noacks.org) (noacks@swbell.net@70.240.205.64 with login) by smtp819.mail.sc5.yahoo.com with SMTP; 12 May 2005 03:28:59 -0000 Received: from localhost (localhost [127.0.0.1]) by optimator.noacks.org (Postfix) with ESMTP id 1DD2D6125; Wed, 11 May 2005 22:28:58 -0500 (CDT) Received: from optimator.noacks.org ([127.0.0.1]) by localhost (optimator.noacks.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18557-03; Wed, 11 May 2005 22:28:56 -0500 (CDT) Received: from compgeek.noacks.org (compgeek [192.168.1.10]) by optimator.noacks.org (Postfix) with ESMTP id 4A571611C; Wed, 11 May 2005 22:28:56 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by compgeek.noacks.org (8.13.3/8.13.3) with ESMTP id j4C3Stfj093381; Wed, 11 May 2005 22:28:55 -0500 (CDT) (envelope-from noackjr@alumni.rice.edu) Message-ID: <4282CD73.1040303@alumni.rice.edu> Date: Wed, 11 May 2005 22:28:51 -0500 From: Jonathan Noack User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050428) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 OpenPGP: id=991D8195; url=http://www.noacks.org/cert/noackjr.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3B1B1BB64F15A2D3AC407303" X-Virus-Scanned: amavisd-new at noacks.org cc: Mikhail Teterin cc: re@freebsd.org cc: stable@freebsd.org Subject: Re: PTHREAD_INVARIANTS in 5.x X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: noackjr@alumni.rice.edu List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 03:29:00 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3B1B1BB64F15A2D3AC407303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 05/11/05 21:53, Daniel Eischen wrote: > On Wed, 11 May 2005, Jonathan Noack wrote: >>I checked out _PTHREADS_INVARIANTS for libthr and libpthread on CURRENT. >> As far as I can tell, all but one of the defines under >>_PTHREADS_INVARIANTS are ASSERTs; they check for a condition and if it >>is false result in a fatal error. These should be very visible if they >>are being tripped. Only MUTEX_INIT_LINK actually *does* something. It >>is defined in src/lib/libpthread/thread/thr_mutex.c at lines 43-46 and >>in src/lib/libthr/thread/thr_mutex.c at lines 44-47: >> >>#define MUTEX_INIT_LINK(m) do { \ >> (m)->m_qe.tqe_prev = NULL; \ >> (m)->m_qe.tqe_next = NULL; \ >>} while (0) >> >>I'm not sure what impact removing this explicit initialization would >>have. If we're not seeing fatal errors, everything else is just slowing >>us down. Assuming we feel our thread implementations are production >>worthy, we should disable these checks for releases. That is, unless I >>am missing something... > > I wrote the darn things, and they are useful in that they can > provide useful information if there are bugs and also for > detecting if the application is linked to multiple thread > libraries. For the init links macro, it is only used when > the mutex is initialized and on unlock. It's two instructions. > The others are also just a couple of instructions and shouldn't > be called often. > > This is way overblown and they're other areas for much > better optimizations than worrying about a couple of > instructions. Perhaps if it were called _PTHREAD_ROBUST > instead of _PTHREAD_INVARIANTS, noone would notice ;-) So I *was* missing something: the Big Picture. Detecting if an application is linked to multiple thread libraries is definitely a keeper. When I see your name in an email, the hash that is my brain returns "threads guy". Your previous responses to this topic (which my brain referenced as authoritative) seemed to indicate that you weren't sure and further investigation was necessary, so I looked into it. Sorry if I misunderstood that. > That's the last I'll say. re@ can do whatever they want > with my blessing. Fair enough. -- Jonathan Noack | noackjr@alumni.rice.edu | OpenPGP: 0x991D8195 --------------enig3B1B1BB64F15A2D3AC407303 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCgs13UFz01pkdgZURAmgUAJ0YlYkHCsbt5UvWkSQ6gQukRpdRaQCg3BP4 HHGW+Fv/DVAamjH9QStfx7g= =BsIW -----END PGP SIGNATURE----- --------------enig3B1B1BB64F15A2D3AC407303--