Re: Latches with weak memory ordering (Re: max_wal_senders must die) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Latches with weak memory ordering (Re: max_wal_senders must die)
Date
Msg-id 29758.1290180966@sss.pgh.pa.us
Whole thread Raw
In response to Re: Latches with weak memory ordering (Re: max_wal_senders must die)  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> ... The reason memory
> barriers solve the problem is because they'll be atomically released
> when we jump into the signal handler, but that is not true of a
> spin-lock or a semaphore.

Hm, I wonder whether your concern is stemming from a wrong mental
model.  There is nothing to "release".  In my view, a memory barrier
primitive is a sequence point, having the properties that all writes
issued before the barrier shall become visible to other processors
before any writes after it, and also that no reads issued after the
barrier shall be executed until those writes have become visible.
(PPC can separate those two aspects, but I think we probably don't
need to get that detailed for our purposes.)  On most processors,
the barrier primitive will just be ((void) 0) because they don't
deal in out-of-order writes anyway.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq changes for synchronous replication
Next
From: Vaibhav Kaushal
Date:
Subject: What do these terms mean in the SOURCE CODE?