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 1wglXL-006NwC-2f for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 15:47:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wglXJ-001WWs-2J for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 15:47:09 +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 1wglXJ-001WWk-0d for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 15:47:09 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wglXG-00000001rvH-2iLu for pgsql-hackers@postgresql.org; Mon, 06 Jul 2026 15:47:08 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-7e9f829d75aso1506897a34.0 for ; Mon, 06 Jul 2026 08:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783352826; x=1783957626; darn=postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=jB/pXEzw3jSFOLgxiaE0jI2bLiZOSPaGckmtRt/h0ow=; b=lZ0hNMjlXGTcuiK3huH6SFVOPeeZd06q3YvhqlW5Y6MdLF2m9qg9RI/nKPqQ9ECRON D+67WfosckTdW3g0CzC3ypC93nYuXBS0qZQphmv0N1KPS7qqbCWWEAmxjnbWrx280KXp 19eY5Em+vELq1BuzN/iVhGl+TeBXxuWk7zcis2xIvzyIc1p6ayHW/O8DwSoYW8ffqy0b XoPDFmV9KJt1EyNxq8spvf5qQQKZcMMby5+FPAskxVv9919ymRs06nzVBuORkAoOcPUj 8t5yTCB5Mj+IlWRhDtci5Z2WhrJeR+L7MMlzHqDWSfWLg65p2ooMhl/8HSm6dTOWRX4l aU2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783352826; x=1783957626; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=jB/pXEzw3jSFOLgxiaE0jI2bLiZOSPaGckmtRt/h0ow=; b=XLKaJ+4c5FoUrK6OeUf1Zk+NeDWIVzVWSkui4uyDO5sYSgz535mms30oMpgwggYbiL WnDqR4d/AEutzfCENffcrvkbBeJd1xyG4YKwXcS3Zt9gkg+9PMsa1NgBKr24KUx/4jkY vSlMlkH/iXPgMQfEg5Gb6BPMf4vxY9Fv4awH3bsuwfrzDlweS8KdtDIDSIfp6BumuBL9 kVfXiBA3NFgLqzFd4O/i6/XT8B3fHgQdgGN8ePMYj1SrU7Zj2HWnXeGX95A1n1k43KvG 2u4MwCfFrNfj5BUj9T7NETfmS3L+rcQU5AGR6eGEoiTKtQhhGIQ1djjp4Wj4EZC7+nNv BAOQ== X-Gm-Message-State: AOJu0YzQDRW6FTt9IedGRRZPs7wbacwKOkIYNxxFn7JhUaNvW3QV6Mmv pW1s6/Ez0oC4yG02HycC/1aq8bp8v1LMD0JCz7JVcGhvA/VSEiuCnQEmvwR/bA== X-Gm-Gg: AfdE7cljDqCWSWrsrYRg/ndWW5iASEsEeOkyd3ajg/drSXRCYgk0n8STIHkidPCVCjv DpkIOWucn+09rHoeP9HV3e5xJF5VOwNGnQeJPDS0IgnBA4xmEooI/rstCzHeI5XodkG0Iip+d9u yGotm3saSlFbF3DvZypU/0ENI8tdM3xB6X/rC+0KD0FTnEsyoYkUCLznhtHytfig9vOVJvZfzGs m702aeuh8ZSjWJ6Do/odY2SbckqZq/Vkb7BKNBWcDJpx0p3/UbBvQXR78bX9Q/GG4h5/1OdUMvH MPjMLDs8eQjHi5BgxpOgeEsb6mcMGdmTuvvMy75+CXxPod0W61wRm0H562+Xk5CGUPOA2kTjtM8 LrQe026KZ7sP8N14AFYHXYx3ynR+/QgUU2reypgCRM9sy9KkPLTV2Fa4bM/N82Li4/mTcM/CeSd ZpI9uMtER211fRIq935ZCEx1bktOohUBWLpQgqYgtli5r5m2JWT5kUFooUEEnEDb9Ui51sGvSJ5 IRdbN9sGx9SQNyvC6VCXw== X-Received: by 2002:a05:6820:615:b0:6a1:4833:fd4f with SMTP id 006d021491bc7-6a3553dae3emr700871eaf.21.1783352825696; Mon, 06 Jul 2026 08:47:05 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-44cfb13c9efsm10975849fac.4.2026.07.06.08.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 08:47:04 -0700 (PDT) Date: Mon, 6 Jul 2026 10:47:03 -0500 From: Nathan Bossart To: Heikki Linnakangas Cc: pgsql-hackers@postgresql.org Subject: Re: remove unnecessary volatile qualifiers Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="z39t9WErpHrlykOW" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --z39t9WErpHrlykOW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 06, 2026 at 02:58:12PM +0300, Heikki Linnakangas wrote: > 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! Thanks for reviewing. >> --- 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.. Done. >> @@ -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. Whoops. You are right. I reverted this part. -- nathan --z39t9WErpHrlykOW Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v2-0001-Remove-unnecessary-volatile-qualifiers.patch