Re: better atomics - spinlock fallback? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: better atomics - spinlock fallback?
Date
Msg-id CA+TgmoaN5VE6XGFPrMfjPdr7sLkjej=RvnzhsfyKBaJC=G13cA@mail.gmail.com
Whole thread Raw
In response to Re: better atomics - spinlock fallback?  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: better atomics - spinlock fallback?  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Mon, Nov 11, 2013 at 1:57 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> Instead of de-supporting platforms that don't have CAS support or
> providing parallel implementations we could relatively easily build a
> spinlock based fallback using the already existing requirement for
> tas().
> Something like an array of 16 spinlocks, indexed by a more advanced
> version of ((char *)(&atomics) >> sizeof(char *)) % 16. The platforms
> that would fallback aren't that likely to be used under heavy
> concurrency, so the price for that shouldn't be too high.
>
> The only real problem with that would be that we'd need to remove the
> spinnlock fallback for barriers, but that seems to be pretty much
> disliked.

I think this is worth considering.  I'm not too clear what to do about
the barriers problem, though.  I feel like we've dug ourselves into a
bit of a hole, there, and I'm not sure I understand the issues well
enough to dig us back out of it.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: logical changeset generation v6.6
Next
From: Andres Freund
Date:
Subject: Re: logical changeset generation v6.6