From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com> |
Subject: | Re: Latches with weak memory ordering (Re: max_wal_senders must die) |
Date: | 2010-11-19 08:07:14 |
Message-ID: | 201011190907.15109.andres@anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Friday 19 November 2010 05:38:14 Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > I'm all in favor of having some memory ordering primitives so that we
> > can try to implement better algorithms, but if we use it here it
> > amounts to a fairly significant escalation in the minimum requirements
> > to compile PG (which is bad) rather than just a performance
> > optimization (which is good).
>
> I don't believe there would be any escalation in compilation
> requirements: we already have the ability to invoke stronger primitives
> than these. What is needed is research to find out what the primitives
> are called, on platforms where we aren't relying on direct asm access.
>
> My feeling is it's time to bite the bullet and do that work. We
> shouldn't cripple the latch operations because of laziness at the
> outset.
I don't think developing the code is the actual code is that hard - s_lock.c
contains nearly everything necessary.
An 'lock xchg' or similar is only marginally slower then the barrier-only
implementation. So doing a TAS() on a slock_t in private memory should be an
easy enough fallback implementation.
So the complicated case seems to be !defined(HAS_TEST_AND_SET) which uses
spinlocks for that purpose - no idea where that is true these days.
Andres
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2010-11-19 08:33:32 | Re: Label switcher function |
Previous Message | KaiGai Kohei | 2010-11-19 07:57:03 | Re: contrib: auth_delay module |