Re: locked reads for atomics

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(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 18:25:00
Message-ID: 274e5925684e71b0df4f7c0f473b8ce6fc6c382b.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2024-02-23 at 10:17 -0600, Nathan Bossart wrote:
> 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.

To be clear:

x = pg_atomic_[read|write]_membarrier_u64(&v);

is semantically equivalent to:

pg_memory_barrier();
x = pg_atomic_[read|write]_u64(&v);
pg_memory_barrier();

?

If so, that does seem more convenient.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-02-23 19:32:47 Re: locked reads for atomics
Previous Message Tomas Vondra 2024-02-23 17:37:59 Re: SQL Property Graph Queries (SQL/PGQ)