better atomics - v0.5 - Mailing list pgsql-hackers

From Andres Freund
Subject better atomics - v0.5
Date
Msg-id 20140625171434.GG24114@awork2.anarazel.de
Whole thread Raw
In response to better atomics  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: better atomics - v0.5  (Robert Haas <robertmhaas@gmail.com>)
Re: better atomics - v0.5  (Amit Kapila <amit.kapila16@gmail.com>)
Re: better atomics - v0.5  (Heikki Linnakangas <hlinnakangas@vmware.com>)
xlc atomics  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
Hi,

[sorry for the second copy Robert]

Attached is a new version of the atomic operations patch. Lots has
changed since the last post:

* gcc, msvc work. acc, xlc, sunpro have blindly written support which
  should be relatively easy to fix up. All try to implement TAS, 32 bit
  atomic add, 32 bit compare exchange; some do it for 64bit as well.

* x86 gcc inline assembly means that we support every gcc version on x86
  >= i486; even when the __sync APIs aren't available yet.

* 'inline' support isn't required anymore. We fall back to
  ATOMICS_INCLUDE_DEFINITIONS/STATIC_IF_INLINE etc. trickery.

* When the current platform doesn't have support for atomic operations a
  spinlock backed implementation is used. This can be forced using
  --disable-atomics.

  That even works when semaphores are used to implement spinlocks (a
  separate array is used there to avoid nesting problems). It contrast
  to an earlier implementation this even works when atomics are mapped
  to different addresses in individual processes (think dsm).

* s_lock.h falls back to the atomics.h provided APIs iff it doesn't have
  native support for the current platform. This can be forced by
  defining USE_ATOMICS_BASED_SPINLOCKS. Due to generic compiler
  intrinsics based implementations that should make it easier to bring
  up postgres on different platfomrs.

* I tried to improve the documentation of the facilities in
  src/include/storage/atomics.h. Including documentation of the various
  barrier semantics.

* There's tests in regress.c that get call via a SQL function from the
  regression tests.

* Lots of other details changed, but that's the major pieces.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Bug in spg_range_quad_inner_consistent for adjacent operator (was Re: Add a filed to PageHeaderData)
Next
From: Robert Haas
Date:
Subject: Re: PostgreSQL for VAX on NetBSD/OpenBSD