Re: BGWriter latch, power saving

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BGWriter latch, power saving
Date: 2012-01-17 11:24:37
Message-ID: 4F155A75.1090309@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17.01.2012 12:16, Heikki Linnakangas wrote:
> On 04.01.2012 17:05, Peter Geoghegan wrote:
>> On 4 January 2012 07:24, Heikki Linnakangas
>> <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>>> I think SetBufferCommitInfoNeedsSave() needs the same treatment as
>>> MarkBufferDirty(). And it would probably be good to only set the
>>> latch if
>>> the buffer wasn't dirty already. Setting a latch that's already set
>>> is fast,
>>> but surely it's even faster to not even try.
>>
>> That seems reasonable. Revised patch is attached.
>
> Thanks! It occurs to me that it's still a bad idea to call SetLatch()
> while holding the buffer header spinlock. At least when it's trivial to
> just move the call after releasing the lock. See attached.
>
> Could you do the sleeping/hibernating logic all in BgWriterNap()?

(sorry, forgot to update the above question before sending..)

In the patch I sent, I did rearrange the sleeping logic. I think it's
more readable the way it is now.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-01-17 12:03:50 review: psql tab completion for GRANT role
Previous Message Fujii Masao 2012-01-17 10:38:23 Re: Online base backup from the hot-standby