From: Nathan Bossart <nathandbossart@gmail.com>
To: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: convert SpinLock* macros to static inline functions
Date: Wed, 18 Feb 2026 12:03:19 -0600
Message-ID: <aZX-54TFRoFo-rwV@nathan> (raw)
In-Reply-To: <CAFcNs+rVmU7eVsJ2Ly907jfx3LPGNNGxUHW2vMBCjdiwGa=XrA@mail.gmail.com>
References: <aZX2oUcKf7IzHnnK@nathan>
<CAFcNs+rVmU7eVsJ2Ly907jfx3LPGNNGxUHW2vMBCjdiwGa=XrA@mail.gmail.com>
On Wed, Feb 18, 2026 at 02:52:46PM -0300, Fabrízio de Royes Mello wrote:
> On Wed, Feb 18, 2026 at 2:28 PM Nathan Bossart <nathandbossart@gmail.com>
> wrote:
>> However, as soon as I did this, I got a bunch of build failures because
>> various parts of the code still use volatile qualifiers quite liberally.
>> It looks like most of these (e.g., see code from commits 2487d872e0,
>> 966fb05b58, 4bc15a8bfb, and 4db3744f1f) predate making spinlocks compiler
>> barriers (commit 0709b7ee72) or were cargo-culted from code that predated
>> it. So, IIUC, it's probably safe to remove these volatile qualifiers now.
>> We could alternatively add volatile qualifiers to the new static inline
>> function parameters, but that seems like it might just encourage continued
>> unnecessary use.
>
> Just wondering if there's some code-path that uses it inside
> PG_TRY..PG_CATCH that can use longjump.
I didn't notice any such code. For reference, we only need "volatile" in
PG_TRY..PG_CATCH code if a local variable is modified in the PG_TRY section
and used in the PG_CATCH section.
--
nathan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, fabriziomello@gmail.com, hlinnaka@iki.fi, andres@anarazel.de
Subject: Re: convert SpinLock* macros to static inline functions
In-Reply-To: <aZX-54TFRoFo-rwV@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox