Re: Broken atomics code on PPC with FreeBSD 10.3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Broken atomics code on PPC with FreeBSD 10.3
Date: 2017-01-03 16:11:51
Message-ID: 24554.1483459911@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Jan 2, 2017 at 4:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2017-01-03 16:12:06 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Previous Message David Fetter 2017-01-03 16:09:18 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE