Re: Sync Rep v17

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Marti Raudsepp <marti(at)juffo(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Daniel Farina <daniel(at)heroku(dot)com>
Subject: Re: Sync Rep v17
Date: 2011-02-22 10:09:48
Message-ID: 201102221109.49130.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday 22 February 2011 09:59:21 Marti Raudsepp wrote:
> On Tue, Feb 22, 2011 at 07:38, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> > + SpinLockAcquire(&WalSndCtl->ctlmutex);
> > + result = WalSndCtl->sync_rep_service_available;
> > + SpinLockRelease(&WalSndCtl->ctlmutex);
> >
> > volatile pointer needs to be used to prevent code rearrangement.
>
> I don't think that's necessary. Spinlock functions already prevent
> reordering using __asm__ __volatile__
>
> Otherwise, surely they would be utterly broken?
Its not the spinlock thats the problem but that "result" may be already loaded
into a register. Thats not prohibited by __asm__ __volatile__.

Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2011-02-22 11:30:55 Re: UNLOGGED tables in psql \d
Previous Message Cédric Villemain 2011-02-22 09:11:49 Re: UNLOGGED tables in psql \d