Re: Obsolete use of volatile in walsender.c, walreceiver.c, walreceiverfuncs.c?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Obsolete use of volatile in walsender.c, walreceiver.c, walreceiverfuncs.c?
Date: 2015-10-16 18:21:18
Message-ID: CA+TgmoZ4+oaRfd8E-7dmDOuSjFSOy_W1EUjcX_r3KyKT762a7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 15, 2015 at 10:36 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Fri, Oct 16, 2015 at 9:07 AM, Thomas Munro
> <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
>> On Wed, Oct 7, 2015 at 8:52 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> On Thu, Oct 1, 2015 at 11:01 PM, Michael Paquier
>>> <michael(dot)paquier(at)gmail(dot)com> wrote:
>>>>> Right, see attached.
>>>>
>>>> It seems to me that we could as well simplify checkpoint.c and
>>>> logical.c. In those files volatile casts are used as well to protect
>>>> from reordering for spinlock operations. See for example 0002 on top
>>>> of 0001 that is Thomas' patch.
>>>
>>> These patches look good to me, so I have committed them.
>>
>> Thanks. Also, spin.h's comment contains an out of date warning about
>> this. Here's a suggested fix for that, and a couple more volatrivia
>> patches.
>
> I have looked at the rest of the code, and it seems that we can get
> rid of volatile in a couple of extra places like in the attached as
> those are used with spin locks. This applies on top of Thomas' set.

OK, committed his, and yours.

I back-patched his spin.h comment fix to 9.5 since that's a factual
error, but the rest of this seems like optimization so I committed it
only to master.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-10-16 18:37:36 Re: [HACKERS] Re: [HACKERS] Windows service is not starting so there’s message in log: FATAL: "could not create shared memory segment “Global/PostgreSQL.851401618”: Permission denied”
Previous Message Andrew Dunstan 2015-10-16 18:19:16 Re: buildfarm failures on crake and sittella