pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pgsql: Add pg_atomic_unlocked_write_u64
Date: Thu, 4 Dec 2025 09:51:10 -0600
Message-ID: <aTGt7q4Jvn97uGAx@nathan> (raw)
In-Reply-To: <E1vQwSk-002fZh-2h@gemulon.postgresql.org>
References: <E1vQwSk-002fZh-2h@gemulon.postgresql.org>

On Wed, Dec 03, 2025 at 11:40:47PM +0000, Andres Freund wrote:
> Add pg_atomic_unlocked_write_u64
> 
> The 64bit equivalent of pg_atomic_unlocked_write_u32(), to be used in an
> upcoming patch converting BufferDesc.state into a 64bit atomic.

I noticed that this new function was defined as

	ptr->value = val;

and couldn't figure out why that was safe.  Above
pg_atomic_unlocked_write_u32(), I see this comment:

 * The write is guaranteed to succeed as a whole, i.e. it's not possible to
 * observe a partial write for any reader.  ...

But the new 64-bit version doesn't seem to be surrounded by a check for
PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY, and I found no discussion about it in
the commit message or the linked thread.  Am I missing something here?

-- 
nathan





view thread (8+ messages)  latest in thread

Message-ID: <aTGt7q4Jvn97uGAx@nathan>
Permalink:  ../aTGt7q4Jvn97uGAx@nathan/
Also on:    postgresql.org/message-id/aTGt7q4Jvn97uGAx@nathan

 · 

reply

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-committers@postgresql.org
  Cc: nathandbossart@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgsql: Add pg_atomic_unlocked_write_u64
  In-Reply-To: <aTGt7q4Jvn97uGAx@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