Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1appUE-0008MZ-CX for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 03:59:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1appUD-0008Rh-Mp for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Apr 2016 03:59:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1appUB-0008QO-W2 for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 03:59:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1appU4-00070K-JX for pgsql-hackers@postgresql.org; Tue, 12 Apr 2016 03:59:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u3C3xLsq003182; Mon, 11 Apr 2016 23:59:21 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org Subject: Re: Re: [COMMITTERS] pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner. In-reply-to: <20160412034704.oowjuayv5kfn3guc@alap3.anarazel.de> References: <1881.1460431476@sss.pgh.pa.us> <20160412033618.c56ksvf3me4mpwii@alap3.anarazel.de> <2490.1460432470@sss.pgh.pa.us> <20160412034704.oowjuayv5kfn3guc@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 11 Apr 2016 20:47:04 -0700" Date: Mon, 11 Apr 2016 23:59:21 -0400 Message-ID: <3181.1460433561@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) 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 Andres Freund writes: >>> The issue is likely that either Alexander or I somehow made >>> MarkLocalBufferDirty() use pg_atomic_fetch_or_u32(), instead of the >>> proper pg_atomic_read_u32()/pg_atomic_write_u32(). > Ok, so the theory above fits. Yah, especially in view of localbuf.c:297 ;-) > Will fix (both initialization and use of pg_atomic_fetch_or_u32), and > expand the documentation on why only atomic read/write are supposed to > be used. FWIW, I'd vote against adding a SpinLockInit there. What it would mostly do is prevent noticing future mistakes of the same ilk. It would be better no doubt if we didn't have to rely on a nearly-dead platform to detect this; but having such detection of a performance bug is better than having no detection. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers