aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-01-03 16:00:06 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-01-03 16:00:06 -0500
commitbc2a050d40976441cdb963ad829316c23e8df0aa (patch)
treec7e308d7ce71769dc527bf068c557318396e19c1 /src
parent63876d3bac5a7471a7987da25a93c13a2534a644 (diff)
downloadpostgresql-bc2a050d40976441cdb963ad829316c23e8df0aa.tar.gz
postgresql-bc2a050d40976441cdb963ad829316c23e8df0aa.zip
Use a non-locking initial test in TAS_SPIN on PPC.
Further testing convinces me that this is helpful at sufficiently high contention levels, though it's still worrisome that it loses slightly at lower contention levels. Per Manabu Ori.
Diffstat (limited to 'src')
-rw-r--r--src/include/storage/s_lock.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index ff7eb1418e6..9b02d1f5a40 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -358,6 +358,9 @@ typedef unsigned int slock_t;
#define TAS(lock) tas(lock)
+/* On PPC, it's a win to use a non-locking test before the lwarx */
+#define TAS_SPIN(lock) (*(lock) ? 1 : TAS(lock))
+
/*
* NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
* an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.