Re: locked reads for atomics

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: locked reads for atomics
Date: 2024-02-23 16:17:58
Message-ID: 20240223161758.GA1697194@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 22, 2024 at 11:53:50AM -0800, Jeff Davis wrote:
> On Thu, 2024-02-22 at 12:58 +0530, Bharath Rupireddy wrote:
>> There's some immediate use for reads/writes with barrier semantics -
>
> Is this mainly a convenience for safety/readability? Or is it faster in
> some cases than doing an atomic access with separate memory barriers?

The former. Besides the 0002 patch tracked here, there's at least one
other patch [0] that could probably use these new functions. The idea is
to provide an easy way to remove spinlocks, etc. and use atomics for less
performance-sensitive stuff. The implementations are intended to be
relatively inexpensive and might continue to improve in the future, but the
functions are primarily meant to help reason about correctness.

I don't mind prioritizing these patches, especially since there now seems
to be multiple patches waiting on it. IIRC I was worried about not having
enough support for this change, but I might now have it.

[0] https://commitfest.postgresql.org/47/4330/

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Давыдов Виталий 2024-02-23 16:29:29 Re: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Peter Eisentraut 2024-02-23 16:15:41 Re: SQL Property Graph Queries (SQL/PGQ)