Re: [HACKERS] Broken atomics code on PPC with FreeBSD 10.3 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Broken atomics code on PPC with FreeBSD 10.3
Date
Msg-id 24554.1483459911@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Broken atomics code on PPC with FreeBSD 10.3  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] Broken atomics code on PPC with FreeBSD 10.3  (Robert Haas <robertmhaas@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE
Next
From: David Fetter
Date:
Subject: Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE