From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Ants Aasma <ants(at)cybertec(dot)at> |
Subject: | Re: better atomics |
Date: | 2013-10-16 19:45:41 |
Message-ID: | 20131016194541.GO5319@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2013-10-16 14:30:34 -0400, Robert Haas wrote:
> > But _and, _or are really useful because they can be used to atomically
> > clear and set flag bits.
>
> Until we have some concrete application that requires this
> functionality for adequate performance, I'd be inclined not to bother.
> I think we have bigger fish to fry, and (to extend my nautical
> metaphor) trying to get this working everywhere might amount to trying
> to boil the ocean.
Well, I actually have a very, very preliminary patch using them in the
course of removing the spinlocks in PinBuffer() (via LockBufHdr()).
I think it's also going to be easier to add all required atomics at once
than having to go over several platforms in independent feature
patches adding atomics one by one.
> > I was thinking of something like:
> > include/storage/atomic.h
> > include/storage/atomic-gcc.h
> > include/storage/atomic-msvc.h
> > include/storage/atomic-acc-ia64.h
> > where atomic.h first has a list of #ifdefs including the specialized
> > files and then lots of #ifndef providing generic variants if not
> > already provided by the platorm specific file.
> Seems like we might want to put some of this in one of the various
> directories called "port", or maybe a new subdirectory of one of them.
Hm. I'd have to be src/include/port, right? Not sure if putting some
files there will be cleaner, but I don't mind it either.
> This basically sounds sane, but I'm unwilling to commit to dropping
> support for all obscure platforms we currently support unless there
> are about 500 people +1ing the idea, so I think we need to think about
> what happens when we don't have platform support for these primitives.
I think the introduction of the atomics really isn't much dependent on
the removal. The only thing I'd touch around platforms in that patch is
adding a generic fallback pg_atomic_test_and_set() to s_lock.h and
remove the special case usages of __sync_lock_test_and_set() (Arm64,
some 32 bit arms).
It's the patches that would like to rely on atomics that will have the
problem :(
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2013-10-16 19:49:54 | Re: removing old ports and architectures |
Previous Message | Andres Freund | 2013-10-16 19:26:37 | Re: removing old ports and architectures |