Re: convert various variables to atomics

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: convert various variables to atomics
Date: 2026-07-22 12:31:49
Message-ID: 9d8c317d-d933-46c7-b675-4b9308eaca2b@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09.07.26 22:50, Nathan Bossart wrote:
> The attached patch set converts various variables to atomics, thereby
> allowing us to remove a handful of spinlocks and volatile qualifiers.
> We've been slowly moving in this direction for a while already. I think
> all of these are pretty straightforward and easy to reason about.

A number of these change signed integers to unsigned integers. Maybe
this doesn't matter in some cases, but it should be analyzed in more detail.

Here is an instance that seems obviously wrong:

/* Buffer id of the buffer that Startup process waits for pin on, or
-1 */
- int startupBufferPinWaitBufId;
+ pg_atomic_uint32 startupBufferPinWaitBufId;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-07-22 12:34:30 Re: Allow pg_read_all_stats to see database size in \l+
Previous Message Marcos Pegoraro 2026-07-22 12:12:02 Re: Proposal: INSERT ... BY NAME