Re: Broken atomics code on PPC with FreeBSD 10.3
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-01-03T16:11:51Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Mon, Jan 2, 2017 at 4:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> After further study, I'm inclined to just propose that we flip the default >> width of pg_atomic_flag in generic-gcc.h: use int not char if both are >> available. The only modern platform where that's the wrong thing is x86, >> and that case is irrelevant here because we'll be using arch-x86.h not >> generic-gcc.h. >> >> A survey of s_lock.h shows that we prefer char-width slock_t only on >> these architectures: >> >> x86 >> sparc (but not sparcv9, there we use int) >> m68k >> vax > I don't think that's right, because on my MacBook Pro: ... which is an x86, which won't be affected by the proposed change. > I think we would be well-advised to get the size of slock_t down to a > single byte on as many platforms as possible, because when it's any > wider than that it makes some critical structures that would otherwise > fit into a cache line start to not fit, and that can have a very big > impact on performance. I really doubt that that's a good argument for choosing a markedly less efficient locking primitive, which is what's at stake for PPC. I have no info about the other architectures. Also, since pg_atomic_flag is currently used in a grand total of zero places (other than the test case in regress.c), arguing that making it word-wide will bloat critical data structures is flat wrong. regards, tom lane
Commits
-
Prefer int-wide pg_atomic_flag over char-wide when using gcc intrinsics.
- 698127a4a9bc 10.0 landed
- 6e5de703b6c7 9.6.2 landed
- 1ed8335ce045 9.5.6 landed
-
Allow Pin/UnpinBuffer to operate in a lockfree manner.
- 48354581a49c 9.6.0 cited
-
Avoid the use of a separate spinlock to protect a LWLock's wait queue.
- 008608b9d510 9.6.0 cited
-
Move buffer I/O and content LWLocks out of the main tranche.
- 6150a1b08a9f 9.6.0 cited
-
Improve spinlock performance for HP-UX, ia64, non-gcc.
- c01c25fbe525 9.2.0 cited