Re: Move PinBuffer and UnpinBuffer to atomics

From: Andres Freund <andres(at)anarazel(dot)de>
To: YUriy Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Move PinBuffer and UnpinBuffer to atomics
Date: 2015-09-15 14:50:44
Message-ID: 20150915145044.GA16920@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-09-15 12:51:24 +0300, YUriy Zhuravlev wrote:
> We had a version like your patch. But this is only half the work. Example:
> state = pg_atomic_read_u32(&buf->state);
> if ((state & BUF_REFCOUNT_MASK) == 0
> && (state & BUF_USAGECOUNT_MASK) == 0)

> After the first command somebody can change buf->state and local state not
> actual.

No, they can't in a a relevant manner. We hold the buffer header lock.

> In this embodiment, there is no significant difference between the two
> patches. For honest work will need used the CAS for all IF statement.

What?

> Thanks! Hope for understanding. ^_^

There's pretty little understanding left at this point. You're posting
things for review and you seem completely unwilling to actually respond
to points raised.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-09-15 14:56:33 Re: Move PinBuffer and UnpinBuffer to atomics
Previous Message Jan Wieck 2015-09-15 14:42:42 Re: [COMMITTERS] pgsql: Fix an O(N^2) problem in foreign key references.