Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqMYR-0003nc-Kj for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Apr 2016 15:18:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aqMYR-0003yp-2Q for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Apr 2016 15:18:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aqMYP-0003w3-Ty for pgsql-hackers@postgresql.org; Wed, 13 Apr 2016 15:18:06 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aqMYM-0006KA-Vo for pgsql-hackers@postgresql.org; Wed, 13 Apr 2016 15:18:04 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 60B0A20ECB for ; Wed, 13 Apr 2016 11:18:02 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 13 Apr 2016 11:18:02 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=zgKmaXsjv/BMGNuLMLkNzOnUiaI=; b=P3joT WgEqa+Q2kJlC97TugRdmlugPArbx/2odKZVnlHjUZxckx59eAQ4zNf3z+j8AO02l olGhI4ntqiT17SjVJjDTuM88jsNJuRH1uP8c2n4jMgMJt17rFa+TNWMugH0ckOGl wvTmrBSajJHJNmUKuhY8WfunD34dKwl56UoQ/c= X-Sasl-enc: PJTlIEGaS94DoiuxoTBvrKX9b+Ru49J9zOyAqSPO1+Hd 1460560682 Received: from intern.anarazel.de (unknown [192.77.237.104]) by mail.messagingengine.com (Postfix) with ESMTPA id 06627680184; Wed, 13 Apr 2016 11:18:02 -0400 (EDT) Date: Wed, 13 Apr 2016 08:18:01 -0700 From: Andres Freund To: Tom Lane Cc: Robert Haas , Alvaro Herrera , Noah Misch , Kevin Grittner , Kevin Grittner , "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160413151801.nafgcxlitagi6fec@alap3.anarazel.de> References: <20160412185625.g7ixnlpwaqvsqt7v@alap3.anarazel.de> <20160413025214.GA954515@alvherre.pgsql> <20160413030530.dfldqhmtojo222c4@alap3.anarazel.de> <20591.1460555524@sss.pgh.pa.us> <21698.1460557237@sss.pgh.pa.us> <22526.1460558523@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22526.1460558523@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 2016-04-13 10:42:03 -0400, Tom Lane wrote: > Robert Haas writes: > > On Wed, Apr 13, 2016 at 10:20 AM, Tom Lane wrote: > >> That's what I thought you were going to say, and it means that any > >> "performance improvement" patch that relies on 64-bit atomics in hotspot > >> code paths is going to be a complete disaster on anything but modern Intel > >> hardware. I'm not sure that's a direction we want to go in. We need to > >> stick to a set of atomics that's pretty widely portable. > > > I think 64-bit atomics *are* pretty widely portable. Can you name a > > system with more than 4 CPU cores that doesn't support them? > > No, you're ignoring my point, which is what happens on single-CPU > 32-bit machines, and whether we aren't going to destroy performance > on low-end machines in pursuit of better performance on high-end. I think generally the only platform of concern wrt is arm (< armv8), which doesn't have 64bit atomicity and doesn't have single-copy-atomicity for 8 byte values either (C.f. https://wiki.postgresql.org/wiki/Atomics). But: > Now, to the extent that a patch uses a 64-bit atomic op to replace > a spinlock acquisition, it might be pretty much a wash if low-end > machines have to use a spinlock to emulate the atomic op. But it > would be really easy for the translation to replace one spinlock > acquisition with multiple spinlock acquisitions, and that would hurt. Which is why I'm actually proposing to *not* use a pg_atomic_uint64, just a single define to remove the spinlock acquisition: http://archives.postgresql.org/message-id/20160413150839.mevdlgekizxyjhc5%40alap3.anarazel.de I think there are a number of LSNs which we'd be better of replacing LSN manipulations with an actual atomic operation (including fallback to the spinlock) might be beneficial. But that'd be a larger patch, and would require more testing; which is why I'm proposing the above. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers