1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Add barriers to the latch code.

Since their introduction latches have required barriers in SetLatch
and ResetLatch - but when they were introduced there wasn't any
barrier abstraction. Instead latches were documented to rely on the
callsites to provide barrier semantics.

Now that the barrier support looks halfway complete, add the necessary
barriers to both latch implementations.

Also remove a now superflous lock acquisition from syncrep.c and a
superflous (and insufficient) barrier from freelist.c. There might be
other cases that can now be simplified, but those are the only ones
I've seen on a quick scan.

We might want to backpatch this at some later point, but right now the
barrier infrastructure in the backbranches isn't totally on par with
master.

Discussion: 20150112154026.GB2092@awork2.anarazel.de
This commit is contained in:
Andres Freund
2015-01-13 12:58:43 +01:00
parent 4bad60e3fd
commit 14e8803f10
5 changed files with 23 additions and 27 deletions

View File

@@ -214,7 +214,6 @@ StrategyGetBuffer(BufferAccessStrategy strategy)
{
/* reset bgwprocno first, before setting the latch */
StrategyControl->bgwprocno = -1;
pg_write_barrier();
/*
* Not acquiring ProcArrayLock here which is slightly icky. It's