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

From Andres Freund
Subject Re: better atomics - spinlock fallback?
Date
Msg-id 20131111185706.GL2401@awork2.anarazel.de
Whole thread Raw
In response to Re: better atomics  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: better atomics - spinlock fallback?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

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.

Thoughts?

Greetings,

Andres Freund

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



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: regclass error reports improperly downcased
Next
From: Andres Freund
Date:
Subject: Re: logical changeset generation v6.5