Re: Our "fallback" atomics implementation doesn't actually work - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Our "fallback" atomics implementation doesn't actually work
Date
Msg-id 20161007235542.ddhgknlhplldpvbn@alap3.anarazel.de
Whole thread Raw
In response to Re: Our "fallback" atomics implementation doesn't actually work  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2016-10-07 17:12:45 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > It's not quite there yet, unfortunately. At the moment
> > pg_atomic_write_u32() is used for local buffers - and we explicitly
> > don't want that to be locking for temp buffers
> > (c.f. 6b93fcd149329d4ee7319561b30fc15a573c6307).
>
> Hm.
>
> > Don't really have a great idea about addressing this, besides either
> > just living with the lock for temp buffers on fallback platforms (which
> > don't have much of a practical relevance), or introduce
> > pg_atomic_unlocked_write_u32() or something. Neither seems great.
>
> Maybe we could hack it with some macro magic that would cause
> pg_atomic_write_u32() to be expanded into a simple assignment in
> localbuf.c only?

I think it's just as well to add a variant that's globally documented to
have no locking, there might be further uses of it. It's already in two
files (bufmgr.c/localbuf.c), and I don't think it's impossible that
further usages will crop up.

Patch that I intend to push soon-ish attached.

Andres

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.