Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1khZpf-0003Ew-FI for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Nov 2020 15:02:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1khZpd-0004lQ-M4 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Nov 2020 15:02:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1khZpc-0004lJ-Qp for pgsql-hackers@lists.postgresql.org; Tue, 24 Nov 2020 15:02:13 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1khZpS-00045h-0F for pgsql-hackers@lists.postgresql.org; Tue, 24 Nov 2020 15:02:12 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id CC5F2F07; Tue, 24 Nov 2020 10:01:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 24 Nov 2020 10:01:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=6d4CcgLHvjkSnuNuM /Qx9uGUBQ+0x+r+fuH6W8eK8wE=; b=O0Ih8kXycTXjtRvoJFoVKBIxD6DesehAJ fayGJCIWfViHnSxetLltVUpWt+riSBijBUX0X+bgeZXKYsp3wtajG3nl8PkXvl7Q 7Q9r8uVmv02erPmIS6nnPBXPiQsAsm3545XLXLweRCMj/KHJYTzqYjz/hpJ2bUiT iIdet/fefQ0hDvTKAOwU+Jp/t++Q6i1Tv3FMNah3h2g5slkjb3PSV6TPcFHemI+f hWTPq7bVNfvBz5EoLOp4pri/g6qVnY3vowWyv/jgNVc7Lc9NKiHchCeCcfbMoJf0 oATMm0jVme7glWEZRJr62VK5RNA1S6Vear7BrLUz7UY2gMQvOMJ3g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudegkedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggujggfsehttdertddtredvnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeevgfelveegueejgefhgeetgefhgeehieefheehleetteei udeiiefhgffgheffteenucfkphepudeltddrleehrddukedrjeelnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 03E893064AA7; Tue, 24 Nov 2020 10:01:56 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 618FA2A0BB8; Tue, 24 Nov 2020 12:01:53 -0300 (-03) Date: Tue, 24 Nov 2020 12:01:53 -0300 From: Alvaro Herrera To: Anastasia Lubennikova Cc: Andres Freund , pgsql-hackers@lists.postgresql.org, Jaime Casanova Subject: Re: LogwrtResult contended spinlock Message-ID: <20201124150153.GA10181@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45bc9909-8f6c-74d8-83ac-d86d35e147cc@postgrespro.ru> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Nov-24, Anastasia Lubennikova wrote: > On 04.09.2020 20:13, Andres Freund wrote: > > Re general routine: On second thought, it might actually be worth having > > it. Even just for LSNs - there's plenty places where it's useful to > > ensure a variable is at least a certain size. I think I would be in > > favor of a general helper function. > Do you mean by general helper function something like this? > > void > swap_lsn(XLogRecPtr old_value, XLogRecPtr new_value, bool to_largest) Something like that, yeah, though maybe name it "pg_atomic_increase_lsn" or some similar name that makes it clear that 1. it is supposed to use atomics 2. it can only be used to *advance* a value rather than a generic swap. (I'm not 100% clear that that's the exact API we need.) > This CF entry was inactive for a while. Alvaro, are you going to continue > working on it? Yes, please move it forward. I'll post an update sometime before the next CF.