From owner-freebsd-arch@freebsd.org Wed Dec 30 14:15:17 2015 Return-Path: Delivered-To: freebsd-arch@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 6EE1DA5665E; Wed, 30 Dec 2015 14:15:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D596114EA; Wed, 30 Dec 2015 14:15:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id tBUEFAxe047375 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 30 Dec 2015 16:15:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua tBUEFAxe047375 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id tBUEFAX0047373; Wed, 30 Dec 2015 16:15:10 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 30 Dec 2015 16:15:10 +0200 From: Konstantin Belousov To: Daniel Eischen Cc: John Baldwin , freebsd-arch@freebsd.org, freebsd-threads@freebsd.org Subject: Re: libthr shared locks Message-ID: <20151230141510.GC3625@kib.kiev.ua> References: <20151224191408.GA3625@kib.kiev.ua> <20151226105409.GH3625@kib.kiev.ua> <20151226234424.GJ3625@kib.kiev.ua> <20151228105157.GQ3625@kib.kiev.ua> <20151229184405.GY3625@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 14:15:17 -0000 On Tue, Dec 29, 2015 at 02:18:27PM -0500, Daniel Eischen wrote: > Perhaps another option is doing all of what we said above > and also use your suggestion of libthr2, but have both libthr > and libthr2, where libthr2 is labeled experimental or something > similar. Have a WITH_LIBTHR2 build flag that conditionally > inlines the pthread locks and enables (links w/-pthread) libthr2 > for FreeBSD base OS. A note/comment for the WITH_LIBTHR2 flag > states that all ports must also be recompiled to be on the > safe side. This allows one to switch back and forth, as long > as any affected ports are also rebuilt. > > If we were to introduce this in a future 12-current, we might > have the WITH_LIBTHR_FOO flag anyway, at least initially, so > perhaps it wouldn't be extra work. This is cheating, but I agree that this is quite plausible approach. I think about also adding the __INLINE_PTHREAD_LOCKS preprocessor macro to select inlined locks at the compilation time. In other words, the user which wants to start experimenting with the stuff would do cc -D__INLINE_PTHREAD_LOCKS -c .... cc -o program ... -lpthread2 I may just do this after I finish with my patches.