pgsql: Improve spinlock performance for HP-UX, ia64, non-gcc.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve spinlock performance for HP-UX, ia64, non-gcc.
Date: 2011-08-29 14:11:57
Message-ID: E1Qy2ZB-0004ZL-5X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve spinlock performance for HP-UX, ia64, non-gcc.

At least on this architecture, it's very important to spin on a
non-atomic instruction and only retry the atomic once it appears
that it will succeed. To fix this, split TAS() into two macros:
TAS(), for trying to grab the lock the first time, and TAS_SPIN(),
for spinning until we get it. TAS_SPIN() defaults to same as TAS(),
but we can override it when we know there's a better way.

It's likely that some of the other cases in s_lock.h require
similar treatment, but this is the only one we've got conclusive
evidence for at present.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c01c25fbe525869fa81237954727e1eb4b7d4a14

Modified Files
--------------
src/backend/storage/lmgr/s_lock.c | 2 +-
src/include/storage/s_lock.h | 35 ++++++++++++++++++++++++-----------
2 files changed, 25 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-08-29 17:18:53 pgsql: Use a non-locking test in TAS_SPIN() on all IA64 platforms.
Previous Message Tom Lane 2011-08-29 02:29:45 pgsql: Actually, all of parallel restore's limitations should be tested