Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wghy2-006LXh-31 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 11:58:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wghy0-00HXL6-1t for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 11:58:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wghy0-00HXKy-0x for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 11:58:28 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wghxx-00000001plR-3IZn for pgsql-hackers@postgresql.org; Mon, 06 Jul 2026 11:58:26 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4gv2tZ4ZPZz49QF8; Mon, 06 Jul 2026 14:58:14 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783339094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6G4pHg1DHtyMdc0A0QEwpmiVL1l3WreBQ8wGeUZf2Tc=; b=Wxd/C7sZAOVQ0og4Tw9EXbClvlldAQ6cqUfd8aBH8+3rb9ZtgOs38kaNGbw74dFI+bjirG tjMwsRYmDH+7zMB6Z75x0u+G+jk9pahYZid9nY8uy+QFETGQXWrvm1yP5OiZmQ8lZhl6HE oEAE3atXCJUkxx0YTmTOO7CbAuZ1a8DQHxKmgA0Pc2ZeZVYdXSZiWLRo0WwBCqGS5MON/n WAVBJE3Qu73hfEPXxX5UfALhlP793MBGuWjwRhOr6SuLIeq1OfspwlKxdJRHbY5dFF2/oD 8HYiQhkqLatBfIep1va1+AzgsuRk8Z7eEUgzW1iFlwrS7CCF23+YPHBM72hA9g== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1783339094; b=lPGEPhLV7HaUWSLt9oi4cQyysoRoDmMe4D7CFvRERf+JWeBs62JeRpTXduCYuTM5UN5exJ 6vJQA1cTMORYQOUeQUOhLvch04cv5n9YGmbSejaEN4ztEEH4heybBWkzbJItCifeYRZUBf g0TDijAEKSbJ3EN/k6TCLCiNbs/HmPLRIRYThLjDETY/cSCFtZjkT9ud1P7465OQATWyDY Ki01f4xY8xTzkVpSiUhSMF7wG1ynLprfcI9KQHLTnD+bctMltBvuh4w8JU/9zvrMnyI6X+ DhKcbDXgNNFAKZOddGDzANYhfWVTQxcKTqrX6X4y/8DAUehe1zhaAUjuwY9yEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783339094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6G4pHg1DHtyMdc0A0QEwpmiVL1l3WreBQ8wGeUZf2Tc=; b=IzTXui63oSe6TvwvK6QoxbZXUBqqm5IW/CJZfN07IPGzjpMiwx7FRIsRzKG7uy1eU8lWnM OYnwpUlprnSY9100Mypj+A67lL/CukxjuJNSZeMlX1mmYLDh1ds2gyKWpe0FtC5dHCugXF qqb/5wMESPrvJwo/4KDN/ODUlhDgjs4MkAmlzfUSR80jFpeaRUAZ4nqq5hapqW51A3Bew6 OQFpIwvhdjesUCfj4YM6W3nj7vZl41uidspjQ4t2cNe/iINNRa71R6tmu09LjvSYzagz+6 x/gF1UQQz5zWGzMdbwlrxalXvkMjQuvWgw4EmREyBQXcWqD74w31UtWP6IQnaw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Mon, 6 Jul 2026 14:58:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: remove unnecessary volatile qualifiers To: Nathan Bossart , pgsql-hackers@postgresql.org References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 01/07/2026 00:47, Nathan Bossart wrote: > I looked into some of these earlier [0], but ended up leaving them alone at > the time. Here is a new patch that removes all of the volatile markers in > the tree that seemed obviously unnecessary to me. Thanks! > --- a/src/backend/access/transam/clog.c > +++ b/src/backend/access/transam/clog.c > @@ -450,7 +450,7 @@ static bool > TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status, > XLogRecPtr lsn, int64 pageno) > { > - volatile PROC_HDR *procglobal = ProcGlobal; > + PROC_HDR *procglobal = ProcGlobal; > PGPROC *proc = MyProc; > uint32 nextidx; > uint32 wakeidx; You might want to get rid of the local variable altogether and just refer to ProcGlobal directly.. > @@ -512,7 +512,7 @@ ProcessProcSignalBarrier(void) > { > uint64 local_gen; > uint64 shared_gen; > - volatile uint32 flags; > + uint32 flags; > > Assert(MyProcSignalSlot); > Are you sure about this one? 'flags' is used in the PG_TRY/CATCH block that follows. It is modified in the PG_TRY(), here: > > /* > * To avoid an infinite loop, we must always unset the bit in > * flags. > */ > BARRIER_CLEAR_BIT(flags, type); and read later in the PG_CATCH() block. The rest looks OK to me. - Heikki