locked reads for atomics

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: locked reads for atomics
Date: 2023-11-10 20:51:28
Message-ID: 20231110205128.GB1315705@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Moving this to a new thread and adding it to the January commitfest.

On Thu, Nov 09, 2023 at 03:27:33PM -0600, Nathan Bossart wrote:
> On Tue, Nov 07, 2023 at 04:58:16PM -0800, Andres Freund wrote:
>> However, even if there's likely some other implied memory barrier that we
>> could piggyback on, the patch much simpler to understand if it doesn't change
>> coherency rules. There's no way the overhead could matter.
> I wonder if it's worth providing a set of "locked read" functions. Those
> could just do a compare/exchange with 0 in the generic implementation. For
> patches like this one where the overhead really shouldn't matter, I'd
> encourage folks to use those to make it easy to reason about correctness.

Concretely, like this.

Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
locked_atomic_reads_v1.patch text/x-diff 3.6 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-11-10 20:54:14 Re: Atomic ops for unlogged LSN
Previous Message Jacob Champion 2023-11-10 20:48:04 Re: pg_dump needs SELECT privileges on irrelevant extension table