Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X1hzr-00043K-At for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2014 20:16:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X1hzq-00060j-O4 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2014 20:16:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X1hzo-0005y1-Fr for pgsql-hackers@postgresql.org; Mon, 30 Jun 2014 20:16:12 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X1hzl-0000Q4-4q for pgsql-hackers@postgresql.org; Mon, 30 Jun 2014 20:16:11 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id C99AD500001; Mon, 30 Jun 2014 22:16:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-5.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p54AF441C.dip0.t-ipconnect.de [84.175.68.28]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id A2EED4F0001; Mon, 30 Jun 2014 22:16:04 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 34E92100058; Mon, 30 Jun 2014 22:16:04 +0200 (CEST) Date: Mon, 30 Jun 2014 22:16:04 +0200 From: Andres Freund To: Tom Lane Cc: Robert Haas , Peter Geoghegan , Pg Hackers , Ants Aasma Subject: Re: better atomics - v0.5 Message-ID: <20140630201604.GN21422@awork2.anarazel.de> References: <54412.1403808435@sss.pgh.pa.us> <20140626190405.GA21422@awork2.anarazel.de> <20140627180033.GF18288@awork2.anarazel.de> <20140628082559.GB6450@awork2.anarazel.de> <11914.1404147250@sss.pgh.pa.us> <12903.1404150352@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12903.1404150352@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2014-06-30 13:45:52 -0400, Tom Lane wrote: > Robert Haas writes: > > I'm personally not convinced that we're approaching this topic in the > > right way. I'm not convinced that it's at all reasonable to try to > > emulate atomics on platforms that don't have them. I would punt the > > problem into the next layer and force things like lwlock.c to have > > fallback implementations at that level that don't require atomics, and > > remove those fallback implementations if and when we move the > > goalposts so that all supported platforms must have working atomics > > implementations. People who write code that uses atomics are not > > likely to think about how those algorithms will actually perform when > > those atomics are merely emulated, and I suspect that means that in > > practice platforms that have only emulated atomics are going to > > regress significantly vs. the status quo today. > > I think this is a valid objection, and I for one am not prepared to > say that we no longer care about platforms that don't have atomic ops > (especially not if it's not a *very small* set of atomic ops). It's still TAS(), cmpxchg(), xadd. With TAS/xadd possibly implemented via cmpxchg (which quite possibly *is* the native implementation for $arch). > Also, just because a platform claims to have atomic ops doesn't mean that > those ops perform well. If there's a kernel trap involved, they don't, > at least not for our purposes. Yea. I think if we start to use 8byte atomics at some later point we're going to have to prohibit e.g. older arms from using them, even if the compiler claims they're supported. But that's just one #define. > This is one > reason why I'm extremely suspicious of depending on gcc's intrinsics for > this; that will not make the issue go away, only make it beyond our > power to control. The patch as submitted makes it easy to provide a platform specific implementation of the important routines if it's likely that it's better than the intrinsics provided one. I'm not too worried about the intrinsics though - the number of projects relying on them these days is quite large. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers