Improve spinlock performance for HP-UX, ia64, non-gcc.
authorRobert Haas <rhaas@postgresql.org>
Mon, 29 Aug 2011 14:05:48 +0000 (10:05 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 1 Jun 2012 12:29:52 +0000 (08:29 -0400)
commit0dd6883570d7b78e5a59abd2119768fa495b4348
tree1ff368269e950187ad848104f6a13b43fc6f77e1
parent9d5c52d044e74eb47250fcc022c77c4cbcc9cc2d
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.
src/backend/storage/lmgr/s_lock.c
src/include/storage/s_lock.h